:root {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  color: #213e34;
  background: #f4f6f2;
  font-size: 14px;
  line-height: 1.6;
  --green: #235c48;
  --muted: #687b70;
  --line: #dfe6dd;
  --amber: #9a6a22;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
a {
  color: var(--green);
  text-decoration: none;
}
button,
.button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
}
button:hover,
.button:hover {
  background: #e9f0e8;
  border-color: #96b39f;
}
.primary {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.primary:hover {
  background: #184633;
}
.danger {
  color: #a33a32;
}
.tiny {
  padding: 5px 9px;
  min-height: 32px;
  font-size: 12px;
}
.layout {
  display: grid;
  grid-template-columns: 228px 1fr;
  min-height: 100vh;
}
.sidebar {
  padding: 30px 18px;
  background: #173e32;
  color: #dce9df;
  position: fixed;
  inset: 0 auto 0 0;
  width: 228px;
  display: flex;
  flex-direction: column;
}
.logo {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 3px;
}
.logo small {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 2px;
  display: block;
  color: #a6c5b3;
}
.system-label {
  margin: 30px 12px 10px;
  font-size: 11px;
  color: #a6c5b3;
  letter-spacing: 2px;
}
.nav {
  display: grid;
  gap: 6px;
}
.nav a {
  color: #d7e5d9;
  padding: 12px 15px;
  border-radius: 8px;
}
.nav a:hover,
.nav a.on {
  background: #32634d;
  color: white;
}
.sidebar-foot {
  margin-top: auto;
  font-size: 12px;
  color: #a6c5b3;
  padding: 20px 12px;
}
.workspace {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--line);
  padding: 17px 32px;
  background: #fcfdfb;
}
.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: #e7eee4;
  border-radius: 50%;
}
.content {
  max-width: 1560px;
  margin: 0 auto;
  padding: 30px 32px 60px;
}
.eyebrow {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
}
h1 {
  font-size: 28px;
  margin: 4px 0 8px;
  font-weight: 650;
  letter-spacing: -0.5px;
}
h2 {
  font-size: 18px;
  margin: 0 0 16px;
}
h3 {
  font-size: 15px;
  margin: 0 0 10px;
}
p {
  margin: 5px 0 16px;
}
.muted {
  color: var(--muted);
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 23px;
  margin-bottom: 20px;
  box-shadow: 0 3px 10px #24413204;
}
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stat {
  font-size: 30px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  margin-top: 12px;
}
.stat small {
  font-size: 13px;
  color: var(--muted);
}
.badge {
  display: inline-flex;
  padding: 3px 9px;
  background: #edf3eb;
  color: #326344;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
}
.badge.warn {
  background: #fbf0db;
  color: #92611d;
}
.badge.off {
  background: #f4e8e4;
  color: #9a4635;
}
.table-wrap {
  overflow: auto;
}
.table-wrap.animal-table td,
.table-wrap.animal-table th {
  padding: 8px 10px;
}
.table-wrap.animal-table .operation-cell .actions { gap: 6px; }
.table-wrap.animal-table .operation-cell .tiny {
  min-height: 28px;
  padding: 3px 7px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  background: #f7f9f5;
  white-space: nowrap;
}
td,
th {
  padding: 13px 14px;
  border-bottom: 1px solid #edf0e9;
}
td {
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: 0;
}
.empty {
  padding: 45px 20px;
  text-align: center;
  color: var(--muted);
}
.filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filters .field {
  min-width: 130px;
}
.filters > .field {
  margin-bottom: 0;
}
.filters > button { align-self: flex-end; margin-bottom: 0; }
.field {
  display: block;
  margin: 0 0 15px;
}
.field > span {
  display: block;
  color: #4f6659;
  font-size: 12px;
  margin-bottom: 6px;
}
input,
select,
textarea {
  border: 1px solid #ccd8cc;
  border-radius: 7px;
  background: #fff;
  padding: 9px 11px;
  color: #213e34;
  min-height: 40px;
  max-width: 100%;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
.select-trigger {
  box-sizing: border-box;
  height: 42px;
  min-height: 42px;
  line-height: 22px;
}
input:not([type="checkbox"]):not([type="file"]),
select,
textarea {
  width: 100%;
}
textarea {
  min-height: 90px;
  resize: vertical;
}
.select-field { min-width: 0; }
.select-control { position: relative; width: 100%; min-width: 0; }
.native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}
.select-trigger {
  width: 100%;
  min-width: 0;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 9px 18px 9px 13px;
  border: 1px solid #ccd8cc;
  border-radius: 7px;
  background: #fff;
  color: #213e34;
}
.select-trigger:hover { background: #fff; border-color: #9bb7a1; }
.select-trigger:focus-visible,
.select-control.is-open .select-trigger {
  border-color: #6f9b7a;
  box-shadow: 0 0 0 3px #dceadf;
}
.select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-chevron {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  margin: -4px 1px 0 0;
  border-right: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.select-control.is-open .select-chevron { margin-top: 4px; transform: rotate(225deg); }
.select-menu {
  position: fixed;
  z-index: 1000;
  display: grid;
  gap: 3px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 36px #173e3226;
}
.select-menu[hidden] { display: none; }
.select-option {
  width: 100%;
  min-height: 38px;
  justify-content: flex-start;
  padding: 8px 11px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: #344c40;
  text-align: left;
}
.select-option:hover,
.select-option:focus-visible { border-color: transparent; background: #f0f5ef; }
.select-option[aria-selected="true"] { background: #eaf2e9; color: var(--green); font-weight: 600; }
.graph-all-complete { opacity: .58; cursor: default; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.form-grid > .field.full-row { grid-column: 1 / -1; }
.product-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  overflow-x: auto;
}
.product-tab {
  flex: 1 0 auto;
  min-height: 42px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
.product-tab:hover { background: #f4f7f2; }
.product-tab.active {
  border-bottom-color: var(--green);
  background: #f0f5ef;
  color: var(--green);
  font-weight: 600;
}
.product-tab-panel[hidden] { display: none; }
.product-tab-panel { min-height: 210px; }
.custom-field-editor { margin: 0 0 18px; }
.custom-field-add {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border: 1px dashed #a9c0ab;
  background: #f7faf6;
  color: #527c5c;
}
.custom-field-add:hover { border-color: #6f9d79; background: #eff5ee; }
.custom-field-list:not(:empty) { margin-top: 0; }
.custom-field-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 1.4fr) auto;
  align-items: end;
  gap: 12px;
}
.custom-field-row + .custom-field-row { margin-top: 8px; }
.custom-field-row .field { min-width: 0; margin: 0; }
.custom-field-row .field input { height: 42px; min-height: 42px; }
.custom-field-remove {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  margin: 0;
  align-self: end;
}
.span2 {
  grid-column: 1/-1;
}
.note {
  padding: 12px 16px;
  background: #eef3e8;
  border-left: 3px solid #709664;
  border-radius: 4px;
  color: #4d6848;
  margin-bottom: 18px;
  font-size: 13px;
}
.note.warn {
  background: #fff4e1;
  border-color: #bd8a36;
  color: #8b642d;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 26px;
  max-width: 760px;
  width: calc(100% - 32px);
  max-height: 90vh;
  box-shadow: 0 25px 100px #132e3433;
}
dialog::backdrop {
  background: #122d2566;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dialog-head h2 {
  margin: 0;
}
dialog.product-edit-dialog[open] {
  display: flex;
  flex-direction: column;
  height: min(780px, 88vh);
  max-height: 88vh;
  z-index: 10;
}
body:has(dialog[open]) .table-wrap thead { z-index: 0; }
.product-edit-dialog > .dialog-head { flex: none; }
.product-edit-dialog #modal-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.product-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 10px 8px 6px;
  scrollbar-gutter: stable;
}
.product-edit-dialog #modal-form > .error:empty { display: none; }
.product-edit-dialog #modal-form > .error { flex: none; }
.product-edit-dialog #modal-form > .actions {
  flex: none;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid #edf0e9;
}
.error {
  color: #a1392e;
  white-space: pre-wrap;
  margin: 10px 0;
}
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-art {
  background: #173e32;
  color: #edf3e8;
  padding: 9vw 6vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-art h1 {
  font-size: 46px;
  line-height: 1.25;
  margin: 30px 0;
}
.login-art p {
  color: #b6d0bd;
}
.login-form {
  padding: 10vw 8vw;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-form form {
  width: 100%;
  max-width: 360px;
}
.mobile-shell {
  max-width: 640px;
  margin: auto;
  padding: 20px 16px 70px;
}
.mobile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.mobile-shell h1 {
  font-size: 25px;
}
.mobile-shell .card {
  padding: 18px;
}
.public-hero {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 12px;
}
.public-gallery {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.public-gallery img {
  width: calc(50% - 5px);
  border-radius: 8px;
}
.graph-stage {
  position: relative;
}
.graph-reset-button {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 7px;
  color: #456b55;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 1px 4px rgb(26 56 40 / 12%);
}
.graph-reset-button svg {
  width: 19px;
  height: 19px;
}
.graph-viewport {
  height: 540px;
  overflow: hidden;
  position: relative;
  background-color: #f8faf5;
  background-image: radial-gradient(#cedccb 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid var(--line);
  border-radius: 9px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: contain;
  cursor: grab;
}
.graph-viewport.is-dragging {
  cursor: grabbing;
}
.graph-caption {
  padding: 10px 2px 0;
  color: var(--muted);
}
.graph-caption-title {
  color: #213e34;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}
.graph-caption-guide,
.graph-caption-summary {
  margin: 3px 0 0;
  font-size: 11px;
  line-height: 1.5;
}
.graph-caption-summary {
  color: #536b5e;
}
.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
  padding: 0;
  list-style: none;
  color: #244a37;
  font-size: 13px;
}
.graph-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f2;
}
.graph-legend strong { font-weight: 600; }
.graph-legend-line {
  width: 28px;
  border-top: 2px solid #91ae98;
}
.graph-legend-line.mother {
  border-top: 2px dashed #c39d79;
}
.graph-legend li.graph-legend-external {
  background: #fff5e3;
  border-color: #c6a66a;
  color: #76551e;
}
.graph-legend-swatch {
  width: 16px;
  height: 12px;
  border: 1.5px solid #c6a66a;
  border-radius: 3px;
  background: #fff5e3;
}
.graph-viewport svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: inherit;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}
.graph-node rect {
  fill: white;
  stroke: #9cbaa0;
  stroke-width: 1.5;
}
.graph-node.external rect {
  fill: #fff5e3;
  stroke: #c6a66a;
}
.graph-node.selected rect {
  stroke: var(--green);
  stroke-width: 2.5;
}
.graph-inline-actions {
  pointer-events: none;
}
.graph-inline-action {
  cursor: pointer;
  pointer-events: auto;
}
.graph-inline-action rect {
  fill: #fff;
  stroke: #cbd9cd;
  stroke-width: 1;
}
.graph-inline-action:hover rect,
.graph-inline-action:focus rect {
  fill: #e9f0e8;
  stroke: #96b39f;
}
.graph-inline-action text {
  fill: #235c48;
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
}
.graph-node text {
  fill: #244a37;
  font-size: 12px;
}
.graph-generation-label {
  fill: #687b70;
  font-size: 11px;
  font-weight: 600;
}
.graph-node {
  cursor: pointer;
}
.graph-edge {
  stroke: #91ae98;
  stroke-width: 1.4;
  fill: none;
}
.graph-edge.mother {
  stroke: #c39d79;
  stroke-dasharray: 5 3;
}
.chart {
  width: 100%;
  height: 170px;
  overflow: visible;
}
.chart text {
  font-size: 11px;
  fill: #687b70;
}
.chart polyline {
  fill: none;
  stroke: #377751;
  stroke-width: 2.5;
}
.chart circle {
  fill: #377751;
}
.loading {
  padding: 50px;
  text-align: center;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: #173e32;
  color: white;
  border-radius: 8px;
  padding: 12px 20px;
  display: none;
  max-width: 90vw;
}
.preview dt {
  color: var(--muted);
  font-size: 12px;
  margin-top: 15px;
}
.preview dd {
  margin: 3px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.clear {
  font-size: 11px;
  margin-left: 8px;
  color: #9c5047;
  cursor: pointer;
}
video {
  max-width: 100%;
  border-radius: 10px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}
.qr {
  width: 210px;
  height: 210px;
  display: block;
  margin: 15px auto;
}
.row-link {
  font-weight: 600;
  cursor: pointer;
  color: var(--green);
}
@media (max-width: 1050px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sidebar {
    width: 190px;
  }
  .layout {
    grid-template-columns: 190px 1fr;
  }
  .content {
    padding: 24px;
  }
  .topbar {
    padding: 16px 24px;
  }
}
@media (max-width: 700px) {
  .layout {
    display: block;
  }
  .sidebar {
    position: static;
    width: auto;
    padding: 15px;
  }
  .sidebar .logo {
    font-size: 19px;
  }
  .system-label,
  .sidebar-foot {
    display: none;
  }
  .nav {
    display: flex;
    overflow: auto;
    margin-top: 12px;
  }
  .nav a {
    white-space: nowrap;
    padding: 8px 12px;
  }
  .workspace {
    display: block;
  }
  .topbar {
    padding: 12px 16px;
  }
  .content {
    padding: 20px 14px;
  }
  .grid,
  .grid.two {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .card {
    padding: 16px;
  }
  .heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  h1 {
    font-size: 24px;
  }
  .stat {
    font-size: 24px;
  }
  .login {
    grid-template-columns: 1fr;
  }
  .login-art {
    padding: 35px;
  }
  .login-art h1 {
    font-size: 30px;
    margin: 15px 0;
  }
  .login-form {
    padding: 35px 25px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid > .field.full-row { grid-column: auto; }
  .custom-field-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .custom-field-row .field:first-child { grid-column: 1 / -1; }
  .custom-field-remove { margin: 0; justify-self: start; }
  .span2 {
    grid-column: auto;
  }
  button,
  .button {
    min-height: 44px;
  }
  .graph-viewport {
    height: 460px;
  }
  .graph-reset-button {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
/* 龙凤共用品牌标识：后台、登录页、公众溯源与现场采集使用同一透明图形。 */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1.35;
  flex-shrink: 0;
}
.brand-symbol {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-word {
  display: block;
  white-space: nowrap;
}
.logo small {
  font-size: 9px;
  letter-spacing: 1px;
  margin-top: 3px;
}
.login-art .brand-symbol {
  width: 60px;
  height: 60px;
}
.mobile-head .brand-symbol {
  width: 38px;
  height: 38px;
}
.mobile-head .logo {
  font-size: 23px;
  gap: 8px;
}
@media (max-width: 700px) {
  .sidebar .brand-symbol {
    width: 38px;
    height: 38px;
  }
  .sidebar .logo {
    font-size: 22px;
  }
}
.system-access {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 190px;
  white-space: nowrap;
}
.space-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 4px 0;
  min-height: 44px;
  color: #687b70;
}
.space-control:hover {
  background: transparent;
  border: 0;
  color: #235c48;
}
.space-control[aria-checked="true"] {
  color: #235c48;
}
.space-switch {
  position: relative;
  display: block;
  width: 40px;
  height: 24px;
  background: #ccd5cd;
  border-radius: 20px;
  transition: background 0.15s;
  flex-shrink: 0;
}
.space-switch::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px #173e3226;
  transition: transform 0.15s;
}
.space-control[aria-checked="true"] .space-switch {
  background: #377751;
}
.space-control[aria-checked="true"] .space-switch::after {
  transform: translateX(16px);
}
.member-config {
  white-space: nowrap;
}
/* 公司空间：固定操作位置，未开通也保留成员入口以便理解和发现。 */
.company-directory,
.audit-directory {
  padding: 0;
  overflow: hidden;
}
.member-management-dialog[open] {
  width: min(900px, calc(100% - 32px));
  max-width: 900px;
  padding: 24px;
}
.member-dialog-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -4px 0 16px;
}
.member-dialog-intro p {
  margin: 0;
  color: var(--muted);
}
.member-dialog-intro strong {
  color: var(--green);
  font-weight: 600;
}
.member-dialog-table .table-wrap {
  height: auto;
  max-height: min(58vh, 520px);
  min-height: 120px;
}
.member-dialog-table .empty {
  padding: 36px 16px;
}
.company-directory-head {
  padding: 22px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.company-directory-head h2 {
  font-size: 16px;
  margin: 0 0 3px;
}
.company-directory-head p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.company-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.company-directory th {
  padding: 13px 22px;
  font-size: 12px;
  background: #f7f9f6;
}
.company-directory td {
  padding: 20px 22px;
}
.company-directory tbody tr:hover {
  background: #fafcf8;
}
.company-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
}
.company-monogram {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #edf2e9;
  color: #426851;
  display: grid;
  place-items: center;
  font-size: 15px;
  flex-shrink: 0;
}
.company-identity strong {
  font-size: 13px;
  font-weight: 600;
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}
.company-identity small {
  display: block;
  font-size: 11px;
  color: #7b887e;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.company-directory .system-access,
.system-access {
  gap: 16px;
  min-width: 208px;
}
.space-control {
  gap: 8px;
  color: #7b887e;
  font-size: 12px;
  min-width: 88px;
  min-height: 36px;
}
.space-switch {
  width: 34px;
  height: 20px;
  background: #d4dbd3;
}
.space-switch::after {
  width: 14px;
  height: 14px;
  top: 3px;
  left: 3px;
  box-shadow: 0 1px 2px #173e321a;
}
.space-control[aria-checked="true"] .space-switch::after {
  transform: translateX(14px);
}
.space-control:focus-visible {
  outline: 2px solid #377751;
  outline-offset: 4px;
  border-radius: 4px;
}
.member-config-wrap {
  display: inline-flex;
}
.member-config {
  min-height: 34px;
  height: 34px;
  padding: 6px 10px;
  gap: 6px;
  border-radius: 7px;
  font-size: 12px;
  color: #315f45;
  border: 1px solid #dce5d9;
  background: #fcfefb;
  white-space: nowrap;
}
.member-config:not(:disabled):hover {
  background: #edf4e9;
  border-color: #a2b99e;
}
.member-config:disabled {
  opacity: 1;
  color: #a4ada3;
  background: #f6f7f4;
  border-color: #e7ebe3;
  cursor: not-allowed;
  box-shadow: none;
}
.member-config:disabled:hover {
  color: #a4ada3;
  background: #f6f7f4;
  border-color: #e7ebe3;
}
.company-details {
  border-color: transparent;
  background: transparent;
  color: #6e7c71;
  font-size: 12px;
  white-space: nowrap;
}
.company-details:hover {
  background: #edf2e9;
  border-color: transparent;
  color: #235c48;
}
.company-cards {
  display: none;
}
@media (max-width: 1100px) {
  .company-desktop {
    display: block;
  }
  .company-cards {
    display: none;
  }
  .company-card {
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
  }
  .company-card:last-child {
    border-bottom: 0;
  }
  .company-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
  .company-card-systems {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 20px;
    padding: 16px;
    background: #f8faf5;
    border-radius: 8px;
  }
  .company-system-label {
    display: block;
    color: #6c7f70;
    font-size: 12px;
    margin-bottom: 7px;
  }
  .company-card footer {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
  }
  .company-card .system-access {
    min-width: 0;
    gap: 12px;
  }
  .company-directory-head {
    padding: 20px;
  }
}
@media (max-width: 700px) {
  .company-card-systems {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 14px;
  }
  .company-card-systems > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 12px;
  }
  .company-card-systems > div + div {
    border-top: 1px solid #e6ecdf;
  }
  .company-system-label {
    margin: 0;
    white-space: nowrap;
  }
  .company-card .system-access {
    gap: 10px;
  }
  .company-directory-head {
    align-items: flex-start;
  }
  .company-directory-head p {
    max-width: 240px;
  }
  .company-card .company-identity {
    min-width: 0;
  }
  .company-cards {
    padding: 0 16px;
  }
  .company-directory td {
    padding: 16px;
  }
}
@media (max-width: 380px) {
  .company-card-systems > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .company-card .system-access {
    justify-content: space-between;
    width: 100%;
  }
}
.company-name-button {
  border: 0;
  background: transparent;
  border-radius: 4px;
  color: #264e39;
  padding: 0;
  min-height: 24px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  justify-content: flex-start;
  gap: 6px;
}
.company-name-button svg {
  flex-shrink: 0;
  color: #a4b2a1;
  transition: transform 0.15s;
}
.company-name-button:hover {
  background: transparent;
  color: #1c6c42;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.company-name-button:hover svg {
  transform: translateX(2px);
  color: #377751;
}
.company-identity small.company-paused {
  color: #a17b43;
}
.company-desktop table {
  table-layout: fixed;
}
.company-desktop th:first-child {
  width: 36%;
}
.company-desktop th:nth-child(2),
.company-desktop th:nth-child(3) {
  width: 32%;
}
.company-settings-dialog {
  max-width: 650px;
  padding: 28px;
}
.company-settings-dialog .dialog-head {
  margin-bottom: 16px;
}
.company-settings-dialog .dialog-head h2 {
  font-size: 20px;
}
.company-settings-dialog .dialog-head button {
  font-size: 12px;
  min-height: 32px;
  border-color: transparent;
  color: #7c897f;
}
.company-settings-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid #e5ebdf;
  background: #f5f8f1;
  border-radius: 10px;
  margin-bottom: 18px;
}
.company-settings-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: #e3ecd9;
  border-radius: 12px;
  color: #456d4b;
  font-size: 19px;
  flex-shrink: 0;
}
.company-settings-intro strong {
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.company-settings-intro p {
  font-size: 12px;
  color: #7b887b;
  margin: 4px 0 0;
}
.company-settings-section {
  margin: 0 0 18px;
}
.company-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}
.company-section-heading h3 {
  font-size: 14px;
  margin: 0;
}
.company-section-heading > span {
  font-size: 11px;
  color: #929c91;
}
.company-settings-section .field {
  margin-bottom: 12px;
}
.company-settings-section input[name="name"] {
  min-height: 44px;
}
.company-state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #e6ebe1;
  border-radius: 9px;
}
.company-state-row strong {
  font-size: 13px;
  font-weight: 500;
}
.company-state-row p {
  font-size: 11px;
  color: #859180;
  margin: 4px 0 0;
  max-width: 350px;
}
.company-state-row .space-control {
  flex-shrink: 0;
}
.company-entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.company-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border: 1px solid #dce7d6;
  background: #fcfefb;
  border-radius: 10px;
  color: #315e41;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.company-entry:not([aria-disabled="true"]):hover {
  background: #f0f6eb;
  border-color: #98b58c;
}
.company-entry-icon {
  display: block;
  margin-bottom: 12px;
  color: #608453;
}
.company-entry strong {
  font-size: 13px;
  font-weight: 500;
}
.company-entry small {
  font-size: 11px;
  color: #82917b;
  margin-top: 4px;
}
.company-entry-arrow {
  position: absolute;
  right: 16px;
  top: 16px;
  color: #7d9772;
  font-size: 17px;
}
.company-entry[aria-disabled="true"] {
  background: #f7f8f5;
  border-color: #e8ece4;
  cursor: not-allowed;
  color: #a6afa2;
}
.company-entry[aria-disabled="true"] .company-entry-icon,
.company-entry[aria-disabled="true"] .company-entry-arrow,
.company-entry[aria-disabled="true"] small {
  color: #b0b8ac;
}
.company-settings-save-note {
  font-size: 11px;
  color: #8a9783;
  padding-bottom: 12px;
  border-bottom: 1px solid #e6ebe0;
  margin-bottom: 12px;
}
.company-settings-dialog #modal-form > .actions {
  justify-content: flex-end;
  flex-direction: row;
  gap: 10px;
}
.company-settings-dialog #modal-form > .actions button {
  min-width: 88px;
}
@media (max-width: 700px) {
  .company-name-button {
    min-height: 36px;
    font-size: 14px;
  }
  .company-settings-dialog {
    padding: 22px 18px;
  }
  .company-settings-intro {
    padding: 16px;
  }
  .company-state-row {
    padding: 12px;
  }
  .company-state-row p {
    max-width: 210px;
  }
  .company-section-heading > span {
    font-size: 10px;
  }
  .company-entry {
    padding: 16px 12px;
  }
  .company-entry strong {
    font-size: 12px;
  }
  .company-entry-arrow {
    right: 12px;
    top: 12px;
  }
}
@media (max-width: 380px) {
  .company-entry-grid {
    grid-template-columns: 1fr;
  }
  .company-state-row {
    align-items: flex-start;
  }
  .company-state-row p {
    max-width: 155px;
  }
}

.company-settings-dialog #modal-form > .actions .primary { order: 2; }
.company-settings-dialog #modal-form > .error:empty { display: none; }
.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 16px 8px 0;
  color: #edf5ed;
}
.sidebar-account .account-name {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.sidebar-account .account-name strong {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-account .account-name small {
  color: #a6c5b3;
  font-size: 11px;
}
.sidebar-account button {
  color: #dce9df;
  border-color: rgba(220, 233, 223, 0.24);
  background: transparent;
  padding: 5px 8px;
}
.sidebar-account button:hover {
  background: #32634d;
}
@media (max-width: 700px) {
  .sidebar-account {
    margin-top: 12px;
    padding: 12px 2px 0;
  }
}
.sidebar .logo {
  width: 100%;
  min-width: 0;
  gap: 9px;
  align-items: center;
}
.sidebar .brand-word {
  flex: 1 1 0;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: var(--brand-name-size, 25px);
  line-height: 1.18;
  letter-spacing: 1px;
}
.sidebar .brand-word small {
  overflow-wrap: anywhere;
  font-size: 9px;
  line-height: 1.25;
  letter-spacing: 0.7px;
}
.sidebar .company-sidebar-brand {
  display: flex;
  align-items: flex-start;
  min-height: 44px;
  margin: 0 10px;
  width: calc(100% - 20px);
  gap: 0;
  flex-shrink: 0;
}
.sidebar .company-sidebar-name {
  display: block;
  width: 100%;
  color: #dce9df;
  font-size: var(--company-name-size, 22px);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
th.operation-heading {
  text-align: right;
}
td.operation-cell {
  text-align: right;
  white-space: nowrap;
}
td.operation-cell > .actions {
  justify-content: flex-end;
}
.archive-action {
  color: #9a5b18;
  border-color: #ead3b6;
  background: #fff8ee;
}
.archive-action:hover {
  color: #80460e;
  border-color: #d9ad79;
  background: #fff0dc;
}
.edit-action {
  color: #356a4c;
  border-color: #cfe0d1;
  background: #f2f8f1;
}
.edit-action:hover {
  color: #28573d;
  border-color: #a9c8af;
  background: #e8f3e7;
}
.create-action {
  color: #356586;
  border-color: #cbdde8;
  background: #f1f7fb;
}
.create-action:hover {
  color: #285673;
  border-color: #a9c8dc;
  background: #e7f2f8;
}
.view-action {
  color: #4d6970;
  border-color: #d2dfe0;
  background: #f4f8f7;
}
.view-action:hover {
  color: #39575d;
  border-color: #b6ccce;
  background: #eaf2f1;
}
.trace-items-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 4px 0 14px;
}
.trace-items-table table {
  font-size: 13px;
}
.trace-items-table th,
.trace-items-table td {
  padding: 8px 12px;
}
.trace-items-table td.operation-cell .actions {
  gap: 6px;
}
.info-text {
  color: #536b60;
  font-size: 13px;
}
.table-action-row th {
  text-align: right;
  padding: 8px 12px 12px;
  border-bottom: 0;
}
th.operation-heading:has(> span) {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.table-wrap {
  height: min(68vh, 640px);
  min-height: 200px;
  overflow: auto;
  overscroll-behavior: contain;
}
.table-region {
  --table-natural-height: 640px;
  display: flex;
  min-width: 0;
  flex-direction: column;
  height: min(var(--table-natural-height), 68vh, 640px, calc(100dvh - 380px));
  min-height: min(var(--table-natural-height), 140px);
}
.table-region .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}
.table-region .table-empty {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  padding: 15px;
}
.table-pagination {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding-top: 8px;
}
.table-pagination > span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}
.table-pagination > button {
  min-height: 34px;
  padding: 5px 10px;
  white-space: nowrap;
}
.daily-records-card {
  height: min(640px, 68vh, calc(100dvh - 390px));
  min-height: 240px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 12px;
}
.daily-records-card .table-region {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}
.daily-records-card .daily-records-table {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: auto;
}
.daily-records-pagination {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 0 0;
}
.daily-records-pagination > button {
  min-height: 36px;
  padding: 6px 12px;
  white-space: nowrap;
}
.daily-records-pagination > span {
  font-size: 12px;
}
.table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 3;
}
.table-wrap thead th {
  background: #f7f9f5;
}
@media (max-width: 700px) {
  .table-wrap {
    height: min(58vh, 520px);
  }
  .table-region {
    height: min(var(--table-natural-height), 58vh, 520px, calc(100dvh - 360px));
    min-height: min(var(--table-natural-height), 120px);
  }
  .table-pagination {
    gap: 5px;
    min-height: 42px;
    padding-top: 6px;
  }
  .table-pagination > button {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }
  .table-pagination > span {
    font-size: 11px;
  }
  .daily-records-card {
    height: min(520px, 58vh, calc(100dvh - 390px));
    min-height: 190px;
    padding: 12px;
  }
  .daily-records-pagination {
    gap: 5px;
    padding-top: 8px;
  }
  .daily-records-pagination > button {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 12px;
  }
  .daily-records-pagination > span {
    font-size: 11px;
  }
}
.qr-dialog {
  z-index: 2;
  max-width: 440px;
  text-align: center;
}
.qr-dialog .dialog-head {
  text-align: left;
}
.qr-dialog .qr {
  margin: 12px auto 20px;
}
.role-choice-field {
  border: 0;
  padding: 0;
  margin: 18px 0;
  min-width: 0;
}
.role-choice-field legend {
  font-weight: 500;
  margin-bottom: 8px;
}
.role-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.role-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  background: #fff;
}
.role-choice:has(input:checked) {
  border-color: #78a184;
  background: #f2f8f1;
  box-shadow: inset 0 0 0 1px #78a184;
}
.role-choice input {
  margin: 3px 0 0;
  accent-color: var(--green);
}
.role-choice span {
  display: grid;
  gap: 3px;
}
.role-choice strong {
  font-size: 13px;
}
.role-choice small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
@media (max-width: 520px) {
  dialog.product-edit-dialog { height: 90vh; max-height: 90vh; padding: 18px; }
  .role-choice-grid {
    grid-template-columns: 1fr;
  }
}
.role-choice-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.role-choice {
  gap: 7px;
  padding: 8px;
  border-radius: 8px;
}
.role-choice strong {
  font-size: 12px;
  line-height: 1.35;
}
.role-choice small {
  font-size: 10px;
  line-height: 1.35;
}
@media (max-width: 700px) {
  .role-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.role-choice input[type="radio"] {
  appearance: auto;
  -webkit-appearance: radio;
  display: inline-block;
  width: 16px !important;
  min-width: 16px;
  max-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 2px 0 0;
  flex: 0 0 16px;
}
.role-choice {
  min-width: 0;
  align-items: flex-start;
}
.role-choice span,
.role-choice strong,
.role-choice small {
  min-width: 0;
  overflow-wrap: anywhere;
}
.legacy-public-page {
  --public-green: #235c48;
  min-height: 100vh;
  padding-top: 40px;
  padding-bottom: 60px;
  background: #f5f7f4;
  color: #263e34;
}
.legacy-public-header {
  position: fixed;
  z-index: 5;
  inset: 0 0 auto;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  overflow: hidden;
  background: var(--public-green);
  color: white;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legacy-public-body {
  width: min(100%, 640px);
  min-height: calc(100vh - 40px);
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 24px #173e3208;
}
.legacy-image-strip {
  display: flex;
  gap: 0;
  width: 100%;
  height: 220px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  background: #e9efea;
  scrollbar-width: none;
}
.legacy-image-strip::-webkit-scrollbar { display: none; }
.legacy-image-strip img {
  flex: 0 0 100%;
  width: 100%;
  height: 220px;
  object-fit: cover;
  scroll-snap-align: center;
}
.legacy-no-image {
  display: grid;
  place-items: center;
  width: 100%;
  color: #829187;
  background: linear-gradient(135deg, #edf2ec, #e2ebe3);
}
.legacy-id-area {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 16px;
  color: #3f5549;
  font-size: 13px;
  background: #f8faf7;
  border-bottom: 1px solid #edf1ec;
}
.legacy-id-area strong {
  min-width: 0;
  color: #263e34;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.legacy-tabs {
  position: fixed;
  z-index: 4;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(var(--tab-count, 4), minmax(0, 1fr));
  width: min(100%, 640px);
  min-height: 80px;
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid #e5ebe5;
  box-shadow: 0 -4px 16px #173e3208;
}
.legacy-tab {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 4px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #77877c;
  font-size: 11px;
}
.legacy-tab span { font-size: 17px; line-height: 1.1; }
.legacy-tab.on { color: var(--public-green); background: #f1f6f0; }
.legacy-section-title {
  margin: 10px 12px 6px;
  padding-left: 10px;
  border-left: 3px solid #6b9877;
  color: #2e4e3d;
  font-size: 15px;
  font-weight: 600;
}
.legacy-info-card {
  margin: 12px 14px;
  padding: 0 14px;
  border: 1px solid #edf0ec;
  border-radius: 8px;
  background: #fff;
}
.legacy-info-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f2ef;
  font-size: 12px;
}
.legacy-info-row:last-child { border-bottom: 0; }
.legacy-info-row > span { color: #7c8a80; }
.legacy-info-row p { margin: 0; color: #33473c; overflow-wrap: anywhere; }
.legacy-tab-heading { display: flex; justify-content: center; align-items: center; gap: 5px; margin: 10px 8px; color: #3f5549; font-size: 14px; font-weight: 600; }
.legacy-info-actions { display: flex; align-items: center; justify-content: space-evenly; gap: 8px; margin: 16px 12px 0; }
.legacy-info-actions button { width: 45%; min-height: 40px; padding: 7px 10px; font-size: 13px; }
.legacy-remark-image { padding: 16px; }
.legacy-content-image { display: block; width: 100%; max-height: none; object-fit: contain; margin: 0; border-radius: 8px; }
.legacy-tab-bottom-space { height: 80px; }
.legacy-article { padding: 9px 0; border-bottom: 1px solid #f0f2ef; }
.legacy-article:last-child { border-bottom: 0; }
.legacy-article strong { font-size: 13px; color: #33473c; }
.legacy-article p,.legacy-long-text { margin: 4px 0 0; color: #607166; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.legacy-empty { margin: 16px 12px; color: #89968d; text-align: center; font-size: 12px; }
.legacy-public-bottom-space { height: 80px; }
.trace-detail-dialog[open] {
  display: flex;
  flex-direction: column;
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  max-height: 86vh;
  padding: 0;
  overflow: hidden;
}
.trace-detail-dialog .dialog-head {
  flex: none;
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid #edf1ec;
}
.trace-detail-dialog .trace-detail-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  overscroll-behavior: contain;
}
.trace-detail-body .legacy-long-text { margin: 0; font-size: 14px; line-height: 1.65; }
.legacy-certificate {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  margin: 0 auto 12px;
  object-fit: contain;
}
.legacy-certificate:last-child { margin-bottom: 0; }
@media (max-width: 520px) {
  .legacy-public-page { padding-bottom: env(safe-area-inset-bottom); }
  .legacy-image-strip,
  .legacy-image-strip img { height: 220px; }
  .legacy-tabs { min-height: calc(80px + env(safe-area-inset-bottom)); }
  .legacy-tab { font-size: 11px; }
  dialog.trace-detail-dialog[open] {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    height: 40dvh;
    max-height: 40vh;
    margin: 0;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
  }
  .trace-detail-dialog .dialog-head { padding: 12px 16px; }
  .trace-detail-dialog .dialog-head h2 { font-size: 18px; }
  .trace-detail-dialog .trace-detail-body { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .legacy-certificate { max-height: calc(40dvh - 76px); margin-bottom: 10px; }
}
.caiji-entry-shell { --green: #205b46; --line: #e3e9e3; padding: 0 0 calc(88px + env(safe-area-inset-bottom)); color: #243f34; touch-action: manipulation; -webkit-font-smoothing: antialiased; }
.caiji-entry-shell .mobile-head { margin: 0; padding: 14px 16px 12px; gap: 12px; background: #edf3ed; border-bottom: 1px solid #dce6dc; }
.caiji-entry-shell .mobile-head > div { min-width: 0; }
.caiji-entry-shell .mobile-head > button { flex-shrink: 0; min-height: 36px; padding: 6px 13px; border-color: #dce5dc; border-radius: 18px; background: #ffffff80; color: #667b6d; font-size: 12px; }
.caiji-entry-shell .caiji-entry-title { margin: 0; color: #193f30; font-size: 24px; font-weight: 650; letter-spacing: -.7px; font-variant-numeric: tabular-nums; line-height: 1.3; overflow-wrap: anywhere; }
.caiji-entry-shell .card { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.caiji-entry-shell > .card { padding: 12px 16px; margin: 0; border-top: 1px solid var(--line); }
.capture-animal-meta { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; color: #78887c; font-size: 12px; }
.capture-animal-meta::before { content: ""; width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: #82a68c; }
.capture-switch { margin: 0; }
.capture-switch > summary { padding: 0; color: var(--green); font-size: 13px; font-weight: 600; cursor: pointer; }
.capture-switch[open] > summary { margin-bottom: 12px; }
.caiji-entry-shell .field { min-width: 0; margin-bottom: 12px; }
.caiji-entry-shell .field > span { margin-bottom: 7px; color: #52675a; font-size: 13px; font-weight: 500; }
.caiji-entry-shell .actions { display: flex; gap: 8px; }
.caiji-entry-shell .actions > button { flex: 1; min-height: 44px; }
.caiji-entry-shell #find-animal .error:empty { display: none; }
.caiji-entry-shell #daily-area .card { padding: 12px 16px; margin: 0; }
.caiji-entry-shell #daily-area .capture-form-card { padding: 0; }
.caiji-entry-shell #daily-area .heading { gap: 12px; margin-bottom: 14px; }
.caiji-entry-shell #daily-area .heading h2 { margin: 0; font-size: 17px; }
.caiji-entry-shell #daily-area .heading .muted { display: none; }
.caiji-entry-shell .capture-date-heading { display: flex; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.capture-today { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.caiji-entry-shell #daily-area .field input,
.caiji-entry-shell input { height: 48px; min-height: 48px; padding: 11px 14px; border: 1px solid #dce5dd; border-radius: 12px; background: #ffffffed; color: #234535; font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 24px; -webkit-appearance: none; appearance: none; box-shadow: 0 1px 2px #25433303; transition: border-color .16s ease, background-color .16s ease; }
.caiji-entry-shell input:focus { outline: none; border-color: #84a48e; background: #fff; box-shadow: none; }
.caiji-entry-shell input:focus-visible { outline: none; border-color: #84a48e; }
.caiji-entry-shell input::placeholder { color: #a3aea5; font-size: 14px; font-weight: 400; }
.caiji-entry-shell input[type="number"] { -moz-appearance: textfield; }
.caiji-entry-shell input::-webkit-inner-spin-button,
.caiji-entry-shell input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.capture-notice { display: block; width: 100%; margin: 0; padding: 0 0 0 16px; background: var(--green); color: #fff; font-size: 12px; line-height: 26px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
.capture-notice::-webkit-scrollbar { display: none; }
.capture-history summary { cursor: pointer; color: #557260; font-size: 13px; font-weight: 600; }
.capture-tabs { display: flex; gap: 0; margin: 0; padding: 0 16px; border-bottom: 1px solid #e3e9e3; background: transparent; }
.caiji-entry-shell .capture-tabs > button { position: relative; flex: 1; min-width: 0; min-height: 46px; padding: 10px 4px 12px; border: 0; border-radius: 0; background: transparent; color: #859087; font-size: 14px; white-space: nowrap; transition: color .16s ease; }
.caiji-entry-shell .capture-tabs > button[aria-selected="true"] { color: #205b46; font-weight: 650; }
.caiji-entry-shell .capture-tabs > button::after { position: absolute; bottom: -1px; left: calc(50% - 12px); width: 24px; height: 3px; border-radius: 3px; background: #205b46; content: ""; transform: scaleX(0); transition: transform .16s ease; }
.caiji-entry-shell .capture-tabs > button[aria-selected="true"]::after { transform: scaleX(1); }
.caiji-entry-shell .capture-tabs > button:hover { color: var(--green); }
.capture-panel[hidden] { display: none; }
.caiji-entry-shell #daily-area .form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px 16px 16px; }
.caiji-entry-shell #daily-area .form-grid .field { margin-bottom: 0; }
.capture-unit { margin-left: 6px; color: #8d9b90; font-size: 11px; font-weight: 400; }
.capture-save-bar { position: fixed; inset: auto 0 0; z-index: 20; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: transparent; border: 0; box-shadow: none; pointer-events: none; }
.caiji-entry-shell .capture-save-bar > button { pointer-events: auto; width: 100%; min-height: 50px; border: 1px solid #205b46; border-radius: 14px; background: linear-gradient(110deg, #2d6a52, #1d523e); color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .5px; white-space: nowrap; box-shadow: 0 5px 14px #1d523e1f, inset 0 1px 0 #ffffff12; transition: transform .16s ease, box-shadow .16s ease; }
.caiji-entry-shell .capture-save-bar > button:hover { background: linear-gradient(110deg, #28614b, #194a38); }
.caiji-entry-shell .capture-save-bar > button:active { transform: translateY(1px); box-shadow: 0 2px 6px #1d523e14; }
.capture-history { padding: 0 16px !important; border-top: 1px solid var(--line) !important; }
.capture-change-empty { margin: 0; padding: 2px 0 14px; color: #87948a; font-size: 12px; line-height: 1.6; }
.capture-change-timeline { margin: 0; padding: 0 0 4px 4px; list-style: none; }
.capture-change-timeline > li { position: relative; padding: 0 0 16px 16px; border-left: 1px solid #dce5dd; }
.capture-change-timeline > li:last-child { border-left-color: transparent; }
.capture-change-timeline > li::before { position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: #c4d4c7; content: ""; }
.capture-change-timeline > li:first-child::before { background: #397254; }
.capture-change-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; font-size: 12px; }
.capture-change-heading time { color: #375543; font-variant-numeric: tabular-nums; font-weight: 600; }
.capture-change-heading > span { color: #79897c; overflow-wrap: anywhere; }
.capture-change-heading > small { margin-left: auto; color: #8c9a8f; font-size: 10px; }
.capture-change-fields { margin: 0; padding: 0; }
.capture-change-fields > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; padding: 5px 0; border-bottom: 1px solid #e9ede7; font-size: 12px; }
.capture-change-fields > div:last-child { border-bottom: 0; }
.capture-change-fields dt { color: #64796a; }
.capture-change-fields dd { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 0 auto; font-variant-numeric: tabular-nums; }
.capture-change-fields dd small { margin-left: 3px; font-size: 10px; font-weight: 400; }
.capture-change-before { color: #95a196; }
.capture-change-arrow { color: #a0ada1; }
.capture-change-after { color: #2a6549; font-weight: 600; }
.capture-change-error { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; color: #a1392e; font-size: 12px; }
.capture-change-error > button { min-height: 36px; padding: 5px 10px; font-size: 12px; }
.capture-history .table-wrap { height: auto; min-height: 0; max-height: none; margin-top: 4px; overflow: visible; }
.capture-history .table-region { height: auto; min-height: 0; }
.caiji-entry-shell .capture-recent-table table { width: 100%; table-layout: fixed; font-size: 12px; font-variant-numeric: tabular-nums; }
.caiji-entry-shell .capture-recent-table thead { position: static; }
.caiji-entry-shell .capture-recent-table th,
.caiji-entry-shell .capture-recent-table td { padding: 9px 4px; white-space: nowrap; text-align: right; }
.caiji-entry-shell .capture-recent-table th { color: #7b8c7f; font-size: 11px; background: transparent; }
.caiji-entry-shell .capture-recent-table th:first-child,
.caiji-entry-shell .capture-recent-table td:first-child { width: 38%; padding-left: 0; text-align: left; }
.caiji-entry-shell .capture-recent-table th:last-child,
.caiji-entry-shell .capture-recent-table td:last-child { padding-right: 0; }
.capture-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0 12px; }
.capture-pagination > span { color: #7b8c7f; font-size: 11px; text-align: center; outline: none; }
.caiji-entry-shell .capture-pagination > button { min-height: 36px; padding: 6px 10px; border-radius: 8px; background: transparent; font-size: 12px; white-space: nowrap; }
.caiji-entry-shell .capture-pagination > button:disabled { opacity: .35; cursor: default; }
.caiji-entry-shell .capture-history > summary,
.caiji-entry-shell .capture-switch > summary { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding: 0; color: #627668; font-size: 13px; font-weight: 500; list-style: none; }
.caiji-entry-shell .capture-history > summary::-webkit-details-marker,
.caiji-entry-shell .capture-switch > summary::-webkit-details-marker { display: none; }
.caiji-entry-shell .capture-history > summary::after,
.caiji-entry-shell .capture-switch > summary::after { content: ""; width: 6px; height: 6px; margin-right: 3px; border-top: 1.5px solid #94a498; border-right: 1.5px solid #94a498; transform: rotate(45deg); transition: transform .16s ease; }
.caiji-entry-shell .capture-history[open] > summary::after,
.caiji-entry-shell .capture-switch[open] > summary::after { transform: rotate(135deg); }
.caiji-entry-shell > .capture-animal { padding-top: 0; padding-bottom: 0; }
.caiji-entry-shell > .capture-animal:has(details[open]) { padding-bottom: 12px; }
@media (prefers-reduced-motion: reduce) {
  .caiji-entry-shell input,
  .caiji-entry-shell .capture-tabs > button,
  .caiji-entry-shell .capture-tabs > button::after,
  .caiji-entry-shell .capture-history > summary::after,
  .caiji-entry-shell .capture-switch > summary::after,
  .caiji-entry-shell .capture-save-bar > button { transition: none; }
}

.caiji-entry-shell .error { font-size: 13px; }
.caiji-entry-shell #daily-form > .error { margin: 0 16px 12px; }
.caiji-entry-shell #daily-form > .error:empty { display: none; }
@media (max-width: 360px) {
  .caiji-entry-shell #daily-area .form-grid { gap: 12px 8px; }
  .caiji-entry-shell .field > span { font-size: 12px; }
}
.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 12px 0 18px;
}
.upload-field {
  min-width: 0;
  margin-bottom: 4px;
}
.upload-widget {
  position: relative;
  display: flex;
  min-height: 128px;
  border: 1px dashed #b8cbb9;
  border-radius: 9px;
  overflow: hidden;
  background: #f7faf6;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-widget:hover,
.upload-widget:focus-within {
  border-color: #6f9d79;
  background: #f0f6ef;
}
.upload-widget.has-image {
  border-style: solid;
  background: #f8faf7;
}
.upload-widget .upload-input {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100% !important;
  height: 100%;
  min-height: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 128px;
  padding: 10px 10px 25px;
}
.upload-preview img {
  display: block;
  max-width: 100%;
  max-height: 112px;
  min-width: 0;
  object-fit: contain;
  border-radius: 5px;
}
.upload-widget[data-multiple="true"] .upload-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: center;
}
.upload-widget[data-multiple="true"] .upload-preview img {
  width: 100%;
  height: 56px;
  object-fit: cover;
}
.upload-empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  color: #7b8d7e;
  font-size: 12px;
}
.upload-empty b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8f0e6;
  color: #527c5c;
  font-size: 20px;
  font-weight: 400;
}
.upload-hint {
  position: absolute;
  z-index: 1;
  right: 8px;
  bottom: 5px;
  color: #89988b;
  font-size: 10px;
  pointer-events: none;
}
@media (max-width: 520px) {
  .upload-grid { grid-template-columns: 1fr; }
}
@media (min-width: 521px) and (max-width: 760px) {
  .upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.upload-widget {
  width: min(100%, 220px);
  min-height: 0;
  aspect-ratio: 1;
}
.upload-preview { min-height: 0; padding: 12px; }
.upload-preview img { width: 100%; height: 100%; max-height: none; object-fit: contain; }
.upload-grid .upload-field-multiple { grid-column: 1 / -1; }
.upload-gallery {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid #dce7dc;
  border-radius: 9px;
  background: #fbfcfa;
}
.upload-gallery .upload-preview { display: contents; }
.upload-gallery .upload-preview img,
.upload-add-tile {
  box-sizing: border-box;
  width: 140px;
  height: 140px;
  border-radius: 8px;
}
.upload-gallery .upload-preview img { border: 1px solid #e1e8e0; object-fit: cover; }
.upload-add-tile {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px dashed #a9c0ab;
  background: #f5f8f4;
  color: #687f6c;
  font-size: 12px;
  cursor: pointer;
}
.upload-add-tile:hover { border-color: #6f9d79; background: #eff5ee; }
.upload-add-tile span { display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.upload-add-tile b { font-size: 24px; font-weight: 400; }
.upload-add-tile .upload-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-field-multiple > .upload-hint {
  position: static;
  display: block;
  margin-top: 6px;
  color: #79897c;
  font-size: 11px;
  pointer-events: auto;
}
@media (max-width: 520px) {
  .upload-widget { width: min(100%, 220px); }
  .upload-gallery { gap: 8px; }
  .upload-gallery .upload-preview img,
  .upload-add-tile { width: min(28vw, 120px); height: min(28vw, 120px); }
}
