:root {
  --ink: #17211f;
  --ink-soft: #52605d;
  --muted: #7b8784;
  --paper: #f4f5f2;
  --surface: #ffffff;
  --line: #dfe3de;
  --line-strong: #cbd1ca;
  --green-950: #062725;
  --green-900: #0a3533;
  --green-800: #0f4844;
  --green-700: #16625b;
  --green-600: #247a70;
  --green-100: #e1efeb;
  --green-50: #eff7f4;
  --gold: #bd9146;
  --gold-dark: #8d672a;
  --gold-light: #f2e7d1;
  --red: #a64138;
  --red-light: #f9e9e6;
  --blue: #316c86;
  --blue-light: #e8f1f5;
  --amber: #ad7623;
  --amber-light: #f9efdc;
  --shadow-sm: 0 1px 2px rgb(12 31 27 / 7%);
  --shadow-md: 0 12px 28px rgb(12 31 27 / 10%);
  --shadow-lg: 0 28px 80px rgb(4 30 27 / 20%);
  --radius: 8px;
  --sidebar-width: 260px;
  --header-height: 76px;
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgb(244 245 242 / 96%), rgb(239 244 240 / 96%)),
    repeating-linear-gradient(45deg, transparent 0 18px, rgb(16 72 68 / 2%) 18px 19px);
}

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

button {
  color: inherit;
}

a {
  color: var(--green-700);
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.nowrap {
  white-space: nowrap;
}

.danger-text {
  color: var(--red) !important;
}

.text-right {
  text-align: right;
}

.eyebrow {
  display: block;
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgb(242 231 209 / 45%);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 14%), transparent),
    var(--green-800);
  color: #fff5e2;
  font-family: STSong, "Songti SC", serif;
  font-size: 26px;
  box-shadow: inset 0 0 0 4px rgb(255 255 255 / 4%);
}

.brand-mark.compact {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  font-size: 20px;
}

.button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.button:hover {
  border-color: var(--green-600);
  background: var(--green-50);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.primary {
  border-color: var(--green-800);
  background: var(--green-800);
  color: #fff;
}

.button.primary:hover {
  border-color: var(--green-700);
  background: var(--green-700);
}

.button.gold {
  border-color: var(--gold-dark);
  background: var(--gold-dark);
  color: white;
}

.button.danger {
  border-color: #d8aaa4;
  background: var(--red-light);
  color: var(--red);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.button.small {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.button.wide {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 5px;
  background: transparent;
  font-size: 19px;
}

.icon-button:hover {
  background: var(--green-50);
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span,
.field-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 6px 9px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgb(36 122 112 / 12%);
}

input[readonly] {
  background: #f6f7f5;
  color: var(--ink-soft);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
}

.checkbox input {
  width: 15px;
  min-height: 15px;
  accent-color: var(--green-700);
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(460px, 1.2fr) minmax(420px, 0.8fr);
  background: #f7f6f1;
}

.login-visual {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 58px;
  background:
    linear-gradient(115deg, rgb(5 37 35 / 96%), rgb(11 69 64 / 92%)),
    radial-gradient(circle at 20% 20%, #447a70, transparent 40%);
  color: white;
}

.login-visual::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(30deg, transparent 49.5%, rgb(255 255 255 / 4%) 50%, transparent 50.5%),
    linear-gradient(150deg, transparent 49.5%, rgb(255 255 255 / 3%) 50%, transparent 50.5%);
  background-size: 150px 86px;
  content: "";
}

.login-brand,
.login-message {
  position: relative;
  z-index: 1;
}

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

.login-brand strong {
  display: block;
  font-family: STSong, "Songti SC", serif;
  font-size: 22px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.login-brand > div > span {
  display: block;
  margin-top: 4px;
  color: rgb(255 255 255 / 58%);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.login-message {
  max-width: 640px;
  margin: 40px 0 70px;
}

.login-message .eyebrow {
  color: var(--gold-light);
}

.login-message h1 {
  margin: 20px 0 24px;
  font-family: STSong, "Songti SC", serif;
  font-size: clamp(38px, 4.4vw, 66px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.login-message p {
  max-width: 580px;
  color: rgb(255 255 255 / 68%);
  font-size: 15px;
  line-height: 1.9;
}

.login-features {
  display: flex;
  margin-top: 34px;
  gap: 24px;
  color: rgb(255 255 255 / 78%);
  font-size: 12px;
}

.login-features span::before {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 8px 2px 0;
  border-radius: 50%;
  background: var(--gold);
  content: "";
}

.gem-orbit {
  position: absolute;
  width: 380px;
  height: 380px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 50%;
  transform: rotate(25deg);
}

.gem-orbit::after {
  position: absolute;
  inset: 42px;
  border: 1px solid rgb(189 145 70 / 30%);
  border-radius: 50%;
  content: "";
}

.gem-orbit-a {
  right: -170px;
  bottom: -80px;
}

.gem-orbit-b {
  right: 60px;
  bottom: -260px;
  width: 520px;
  height: 520px;
}

.login-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 54px;
  background:
    radial-gradient(circle at 85% 10%, rgb(189 145 70 / 10%), transparent 26%),
    #f8f7f2;
}

.login-card {
  width: min(390px, 100%);
  padding: 36px;
  border: 1px solid #e3dfd4;
  border-top: 3px solid var(--gold);
  background: rgb(255 255 255 / 92%);
  box-shadow: var(--shadow-md);
}

.login-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
}

.login-card-head h2 {
  margin: 0 0 4px;
  font-family: STSong, "Songti SC", serif;
  font-size: 25px;
  font-weight: 600;
}

.login-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.login-card .field {
  margin-bottom: 16px;
}

.login-card input {
  height: 43px;
  border-color: #d9d7ce;
}

.login-card .button {
  height: 43px;
  margin-top: 7px;
}

.login-help {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding: 12px;
  background: #f6f3eb;
  color: var(--ink-soft);
  font-size: 11px;
}

.login-security {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.login-footer {
  align-self: end;
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 2%), transparent 15%),
    var(--green-950);
  color: rgb(255 255 255 / 78%);
  box-shadow: 8px 0 30px rgb(5 29 27 / 9%);
}

.sidebar-brand {
  display: flex;
  height: var(--header-height);
  align-items: center;
  gap: 11px;
  padding: 0 20px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.sidebar-brand strong {
  display: block;
  color: white;
  font-family: STSong, "Songti SC", serif;
  font-size: 14px;
  letter-spacing: 0;
  white-space: nowrap;
}

.sidebar-brand span:not(.brand-mark) {
  display: block;
  margin-top: 3px;
  color: rgb(255 255 255 / 38%);
  font-size: 9px;
  letter-spacing: 0.15em;
}

.sidebar-close {
  display: none;
  margin-left: auto;
  color: white;
}

.main-nav {
  overflow: auto;
  flex: 1;
  padding: 15px 11px 20px;
  scrollbar-width: thin;
}

.nav-group {
  margin-bottom: 17px;
}

.nav-group-label {
  padding: 0 10px 7px;
  color: rgb(255 255 255 / 32%);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.nav-link {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 11px;
  margin: 2px 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: rgb(255 255 255 / 67%);
  cursor: pointer;
  text-align: left;
}

.nav-link:hover {
  background: rgb(255 255 255 / 6%);
  color: white;
}

.nav-link.active {
  background:
    linear-gradient(90deg, rgb(189 145 70 / 14%), transparent),
    rgb(255 255 255 / 7%);
  color: #fff6e7;
}

.nav-link.active::before {
  position: absolute;
  left: -11px;
  width: 3px;
  height: 22px;
  background: var(--gold);
  content: "";
}

.nav-icon {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 4px;
  font-family: STSong, "Songti SC", serif;
  font-size: 11px;
}

.nav-link.active .nav-icon {
  border-color: rgb(189 145 70 / 60%);
  color: var(--gold-light);
}

.sidebar-foot {
  display: grid;
  gap: 8px;
  padding: 15px 20px;
  border-top: 1px solid rgb(255 255 255 / 7%);
  color: rgb(255 255 255 / 30%);
  font-size: 9px;
}

.system-state {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgb(255 255 255 / 52%);
  font-size: 10px;
}

.state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #56c49a;
  box-shadow: 0 0 0 4px rgb(86 196 154 / 10%);
}

.app-main {
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 93%);
  backdrop-filter: blur(14px);
}

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

.breadcrumb {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.topbar h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.menu-open {
  display: none;
}

.topbar-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.work-context {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 10px;
}

.context-divider {
  width: 1px;
  height: 12px;
  background: var(--line-strong);
}

.quick-search {
  display: flex;
  width: 240px;
  height: 34px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f7f8f5;
  color: var(--muted);
  cursor: pointer;
  padding: 0 10px;
  font-size: 11px;
  text-align: left;
}

.quick-search:hover {
  border-color: var(--green-600);
  background: white;
}

kbd {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: white;
  color: var(--muted);
  padding: 2px 5px;
  font-family: inherit;
  font-size: 9px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.user-chip strong {
  display: block;
  font-size: 12px;
}

.user-chip small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.user-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-800);
  font-family: STSong, "Songti SC", serif;
  font-size: 15px;
  font-weight: 700;
}

.chevron {
  color: var(--muted);
  font-size: 12px;
}

.user-menu {
  position: absolute;
  z-index: 50;
  top: 52px;
  right: 0;
  display: grid;
  width: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  box-shadow: var(--shadow-md);
}

.user-menu-head {
  display: grid;
  gap: 3px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafaf8;
}

.user-menu-head strong {
  font-size: 12px;
}

.user-menu-head span {
  color: var(--muted);
  font-size: 10px;
}

.user-menu button {
  border: 0;
  border-bottom: 1px solid #f0f1ee;
  background: white;
  cursor: pointer;
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
}

.user-menu button:hover {
  background: var(--green-50);
}

.view {
  min-height: calc(100vh - var(--header-height));
  padding: 22px 26px 40px;
  outline: none;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-head h2 {
  margin: 0 0 5px;
  font-family: STSong, "Songti SC", serif;
  font-size: 24px;
  font-weight: 600;
}

.page-head p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.page-actions,
.toolbar,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar {
  min-height: 49px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: white;
}

.toolbar .toolbar-spacer {
  flex: 1;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #f7f8f5;
}

.segmented button {
  min-height: 30px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px 11px;
  font-size: 10px;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button:hover {
  background: var(--green-50);
}

.segmented button.active {
  background: var(--green-800);
  color: white;
}

.compact-field {
  width: 118px;
}

.batch-entry-tools {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #f8faf6;
}

.batch-entry-hint {
  display: grid;
  gap: 3px;
  min-width: 280px;
}

.batch-entry-hint strong {
  color: var(--green-800);
  font-size: 11px;
}

.batch-entry-hint span {
  color: var(--muted);
  font-size: 9px;
}

.batch-entry-hint .association-feedback {
  color: var(--green-700);
  font-weight: 600;
}

.batch-entry-hint .association-feedback.active {
  color: var(--gold-dark);
}

.batch-photo-review {
  max-height: 430px;
  overflow: auto;
}

.selection-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  white-space: nowrap;
}

.selection-count input {
  width: 14px;
  min-height: 14px;
  accent-color: var(--green-700);
}

.bulk-status-control {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.bulk-status-control select {
  width: 108px;
  min-width: 108px;
  min-height: 32px;
  padding-right: 24px;
}

.batch-entry-wrap {
  overflow: auto;
  max-height: calc(100vh - 350px);
  min-height: 250px;
  border: 1px solid var(--line);
  background: white;
}

.batch-entry-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 10px;
  table-layout: fixed;
}

.batch-entry-table th {
  position: sticky;
  z-index: 5;
  top: 0;
  height: 35px;
  border-right: 1px solid #dfe3dd;
  border-bottom: 1px solid var(--line-strong);
  background: #eef2ed;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
  padding: 5px 6px;
  text-align: left;
  white-space: nowrap;
}

.batch-entry-table th em {
  color: var(--red);
  font-style: normal;
}

.batch-entry-table td {
  height: 34px;
  border-right: 1px solid #edf0ea;
  border-bottom: 1px solid #edf0ea;
  background: white;
  padding: 2px 3px;
  vertical-align: middle;
}

.batch-entry-table tbody tr:hover td {
  background: #fafcf9;
}

.batch-entry-table tbody tr.dirty-row td {
  background: #fff9e9;
}

.batch-entry-table tbody tr.locked-row td {
  background: #f6f7f4;
  color: var(--ink-soft);
}

.batch-entry-table .select-cell {
  position: sticky;
  z-index: 6;
  left: 0;
  width: 64px;
  min-width: 64px;
  border-right: 1px solid var(--line-strong);
  background: #f4f6f2;
  text-align: center;
}

.batch-entry-table th:nth-child(2),
.batch-entry-table td:nth-child(2) {
  position: sticky;
  z-index: 4;
  left: 64px;
  border-right: 1px solid var(--line-strong);
}

.batch-entry-table thead .select-cell,
.batch-entry-table thead th:nth-child(2) {
  z-index: 8;
  background: #e9eee8;
}

.batch-entry-table tbody tr:hover td:nth-child(2),
.batch-entry-table tbody tr.dirty-row td:nth-child(2),
.batch-entry-table tbody tr.locked-row td:nth-child(2) {
  background: inherit;
}

.grid-row-select {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--muted);
  font-size: 8px;
}

.grid-header-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 9px;
  cursor: pointer;
}

.grid-header-select input {
  width: 14px;
  min-height: 14px;
  margin: 0;
  accent-color: var(--green-700);
}

.grid-row-select input {
  width: 13px;
  min-height: 13px;
  accent-color: var(--green-700);
}

.grid-input {
  width: 100%;
  min-width: 0;
  min-height: 27px;
  border-color: transparent;
  border-radius: 3px;
  background: transparent;
  padding: 2px 5px;
  font-size: 10px;
}

.grid-input:hover {
  border-color: #d6dcd4;
  background: white;
}

.grid-input:focus {
  border-color: var(--green-600);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgb(36 122 112 / 20%);
}

.grid-readonly {
  display: block;
  overflow: hidden;
  padding: 4px 5px;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-readonly.locked-value {
  color: var(--ink-soft);
}

.batch-entry-table .number-cell .grid-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.qr-cell,
.sample-photo-cell,
.photo-path-cell {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 1px;
}

.qr-cell {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
}

.qr-cell svg {
  display: block;
  width: 56px;
  height: 56px;
}

.sample-photo-cell {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}

.sample-photo-cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sample-photo-empty {
  display: inline-block;
  color: var(--muted);
  font-size: 8px;
}

.photo-path-cell {
  display: block;
  overflow: hidden;
  max-width: 170px;
  color: var(--green-700);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-modal-content {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 12px;
  text-align: center;
}

.qr-modal-content svg {
  width: min(320px, 72vw);
  height: min(320px, 72vw);
}

.qr-modal-content strong {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 16px;
  letter-spacing: 0.08em;
}

.qr-modal-content span {
  color: var(--muted);
  font-size: 11px;
}

.sample-photo-preview {
  display: grid;
  min-height: 360px;
  place-items: center;
  background: #f4f5f2;
}

.sample-photo-preview img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.batch-entry-table .row-action {
  position: sticky;
  z-index: 4;
  right: 0;
  width: 44px;
  min-width: 44px;
  border-left: 1px solid var(--line-strong);
  background: #f8f9f6;
  text-align: center;
}

.batch-entry-footer {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 16px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-top: 0;
  background: #fcfcf9;
}

.batch-entry-footer #batch-dirty-summary {
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 600;
}

.batch-entry-footer .small {
  flex: 1;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel + .panel {
  margin-top: 16px;
}

.panel-head {
  display: flex;
  min-height: 47px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 13px;
}

.panel-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.panel-body {
  padding: 15px;
}

.panel-head + .panel-body {
  padding-top: 13px;
}

.panel-body.flush {
  padding: 0;
}

.dashboard-hero {
  position: relative;
  display: flex;
  overflow: hidden;
  min-height: 156px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 26px 28px;
  border-radius: var(--radius);
  background:
    linear-gradient(110deg, #0a3936, #145951 72%, #276d61);
  color: white;
  box-shadow: var(--shadow-md);
}

.dashboard-hero::after {
  position: absolute;
  right: -45px;
  width: 300px;
  height: 300px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 50px rgb(255 255 255 / 2%);
  content: "";
}

.dashboard-hero h2 {
  margin: 8px 0 8px;
  font-family: STSong, "Songti SC", serif;
  font-size: 28px;
  font-weight: 500;
}

.dashboard-hero p {
  margin: 0;
  color: rgb(255 255 255 / 60%);
  font-size: 11px;
}

.dashboard-hero .eyebrow {
  color: var(--gold-light);
}

.hero-stats {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 30px;
  padding-left: 35px;
}

.hero-stat strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 400;
}

.hero-stat span {
  color: rgb(255 255 255 / 50%);
  font-size: 10px;
}

.stat-grid {
  display: grid;
  margin-bottom: 16px;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
}

.stat-card {
  min-height: 102px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--green-600);
  border-radius: 6px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.stat-card.gold {
  border-top-color: var(--gold);
}

.stat-card.amber {
  border-top-color: var(--amber);
}

.stat-card.red {
  border-top-color: var(--red);
}

.stat-card.blue {
  border-top-color: var(--blue);
}

.stat-card span {
  color: var(--muted);
  font-size: 10px;
}

.stat-card strong {
  display: block;
  margin: 7px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 500;
}

.stat-card small {
  color: var(--muted);
  font-size: 9px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr;
  gap: 16px;
}

.metric-row {
  display: grid;
  gap: 12px;
}

.metric-item {
  display: grid;
  grid-template-columns: 90px 1fr 44px;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 11px;
}

.metric-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 20px;
  background: #edf0eb;
}

.metric-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-700), #54a58e);
}

.metric-item:nth-child(even) .metric-bar i {
  background: linear-gradient(90deg, var(--gold-dark), #d4b273);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.quick-tile {
  display: grid;
  min-height: 82px;
  place-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fbfcf9;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}

.quick-tile:hover {
  border-color: var(--green-600);
  background: var(--green-50);
}

.quick-tile b {
  color: var(--green-700);
  font-family: STSong, "Songti SC", serif;
  font-size: 18px;
}

.quick-tile span {
  font-size: 10px;
}

.template-manager-grid {
  display: grid;
  align-items: start;
  margin-bottom: 14px;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 14px;
}

.template-manager-list .panel-body {
  padding: 14px;
}

.template-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.template-manager-head h3 {
  margin: 0;
  font-size: 17px;
}

.template-manager-head span {
  color: var(--muted);
  font-size: 10px;
}

.template-manager-list .selected-template {
  overflow: hidden;
  margin-bottom: 6px;
  color: #9e372b;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-manager-list .template-list {
  height: 520px;
  overflow: auto;
  border: 1px solid #c5cbc3;
  background: white;
}

.template-manager-list .template-item {
  display: flex;
  min-height: 27px;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid #eef0ec;
  cursor: pointer;
  padding: 3px 7px;
  font-size: 11px;
}

.template-manager-list .template-item:hover {
  background: #f4f8f4;
}

.template-manager-list .template-item.selected {
  background: #dfe8e5;
  font-weight: 600;
}

.template-manager-list .template-item input {
  width: 14px;
  min-height: 14px;
  margin: 0;
  accent-color: #1e6a60;
}

.template-manager-list .template-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-editor-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f7f9f5;
}

.template-editor-toolbar .field {
  min-width: 260px;
}

.template-editor-toolbar #template-editor-version {
  min-width: 220px;
}

#template-editor-dirty {
  margin-bottom: 7px;
  color: var(--green-700);
  font-size: 10px;
}

#template-editor-dirty.dirty {
  color: var(--gold-dark);
  font-weight: 700;
}

.template-editor-layout {
  display: grid;
  align-items: start;
  grid-template-columns: 235px minmax(420px, 1fr) 305px;
  gap: 12px;
}

.template-object-panel .panel-body,
.template-property-panel .panel-body {
  max-height: calc(100vh - 255px);
  overflow: auto;
}

.template-object-list {
  display: grid;
  max-height: 620px;
  margin-top: 11px;
  overflow: auto;
  gap: 4px;
}

.template-object-item {
  display: grid;
  width: 100%;
  min-height: 42px;
  align-items: center;
  border: 1px solid #e2e6df;
  border-radius: 4px;
  background: white;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 7px;
  text-align: left;
}

.template-object-item:hover {
  border-color: var(--green-500);
  background: #f7fbf8;
}

.template-object-item.active {
  border-color: var(--green-700);
  background: var(--green-50);
}

.template-object-item.is-hidden {
  opacity: 0.55;
}

.template-object-item > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.template-object-item b,
.template-object-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-object-item b {
  font-size: 10px;
  font-weight: 600;
}

.template-object-item small {
  color: var(--muted);
  font-size: 8px;
}

.template-object-type {
  border-radius: 3px;
  background: #e9eeea;
  color: var(--green-700);
  padding: 3px 5px;
  font-size: 8px;
  white-space: nowrap;
}

.template-canvas-panel {
  min-width: 0;
  overflow: hidden;
}

.template-canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 9px;
}

.template-canvas-scroll {
  display: grid;
  min-height: 470px;
  max-height: 760px;
  overflow: auto;
  background:
    linear-gradient(45deg, #eef0ec 25%, transparent 25%),
    linear-gradient(-45deg, #eef0ec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef0ec 75%),
    linear-gradient(-45deg, transparent 75%, #eef0ec 75%);
  background-color: #f7f8f5;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  padding: 18px;
  place-items: start center;
}

.template-editor-canvas {
  position: relative;
  width: 720px;
  min-width: 180px;
  overflow: hidden;
  outline: 1px solid #cbd0c9;
  background: white;
  box-shadow: 0 8px 24px rgb(20 40 31 / 14%);
  touch-action: none;
  user-select: none;
}

.template-editor-preview-image {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.template-object-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
}

.template-page-guide {
  position: absolute;
  z-index: 2;
  inset: 0;
  border: 1px solid rgb(31 111 96 / 38%);
  pointer-events: none;
}

.template-canvas-object {
  position: absolute;
  z-index: 1;
  min-width: 2px;
  min-height: 2px;
  border: 1px dashed rgb(46 112 159 / 55%);
  background: rgb(46 112 159 / 5%);
  cursor: move;
}

.template-canvas-object.BarcodeObject {
  border-color: rgb(191 139 38 / 65%);
  background: rgb(191 139 38 / 7%);
}

.template-canvas-object.PictureObject {
  border-color: rgb(39 132 112 / 58%);
  background: rgb(39 132 112 / 6%);
}

.template-canvas-object.ShapeObject,
.template-canvas-object.LineObject {
  border-color: rgb(120 100 151 / 55%);
  background: rgb(120 100 151 / 5%);
}

.template-canvas-object:hover {
  z-index: 6;
  border-color: #1e6a60;
  background: rgb(30 106 96 / 9%);
}

.template-canvas-object.selected {
  z-index: 8;
  border: 2px solid var(--green-700);
  background: rgb(30 106 96 / 10%);
  box-shadow: 0 0 0 2px rgb(255 255 255 / 88%);
}

.template-canvas-object.is-hidden {
  opacity: 0.28;
}

.template-canvas-object > span {
  position: absolute;
  top: -18px;
  left: -1px;
  display: none;
  max-width: 240px;
  overflow: hidden;
  border-radius: 3px 3px 0 0;
  background: var(--green-800);
  color: white;
  padding: 2px 5px;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.template-canvas-object.selected > span,
.template-canvas-object:hover > span {
  display: block;
}

.template-resize-handle {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--green-700);
  box-shadow: 0 1px 4px rgb(0 0 0 / 30%);
  cursor: nwse-resize;
}

.template-canvas-hint {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 11px;
  font-size: 9px;
}

.template-canvas-loading {
  display: grid;
  min-height: 440px;
  place-items: center;
  color: var(--muted);
}

.template-property-section + .template-property-section {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

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

.template-property-grid .field input,
.template-property-grid .field select {
  min-width: 0;
}

.template-property-panel textarea {
  min-height: 92px;
}

.tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  min-width: 90px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 11px 15px;
  font-size: 12px;
}

.tab.active {
  color: var(--green-800);
  font-weight: 700;
}

.tab.active::after {
  position: absolute;
  right: 15px;
  bottom: -1px;
  left: 15px;
  height: 2px;
  background: var(--gold);
  content: "";
}

.filters {
  display: grid;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #fafbf8;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.filters .wide {
  grid-column: span 2;
}

.filters .actions {
  display: flex;
  align-items: end;
  gap: 7px;
}

.batch-detection-hint {
  grid-column: 1 / -1;
  min-height: 17px;
  color: var(--muted);
  font-size: 9px;
}

.batch-detection-hint.matched {
  color: var(--green-700);
  font-weight: 600;
}

.batch-detection-hint.warning {
  color: #a36a19;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px 16px;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid .span-3 {
  grid-column: span 3;
}

.form-grid .span-4 {
  grid-column: span 4;
}

.form-section {
  margin-bottom: 18px;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  color: var(--green-800);
  font-size: 12px;
  font-weight: 700;
}

.form-section-title::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: white;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.data-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  height: 37px;
  border-right: 1px solid #eceee9;
  border-bottom: 1px solid var(--line-strong);
  background: #f5f7f3;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  height: 38px;
  border-right: 1px solid #f0f1ee;
  border-bottom: 1px solid #eceee9;
  padding: 5px 9px;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #f8fbf8;
}

.data-table tbody tr.selected {
  background: #edf6f2;
}

.data-table th,
.data-table td {
  padding-right: 9px;
  padding-left: 9px;
}

.data-table td.check,
.data-table th.check {
  width: 34px;
  text-align: center;
}

.data-table input[type="checkbox"] {
  width: 14px;
  min-height: 14px;
  accent-color: var(--green-700);
}

.data-table .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .mono {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
}

.data-table .photo-cell {
  width: 43px;
}

.thumb {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 3px;
  object-fit: cover;
  background: #f3f4f1;
}

.thumb-placeholder {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 3px;
  color: var(--muted);
  font-size: 9px;
}

.badge {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.green {
  background: var(--green-100);
  color: var(--green-800);
}

.badge.amber {
  background: var(--amber-light);
  color: var(--amber);
}

.badge.blue {
  background: var(--blue-light);
  color: var(--blue);
}

.badge.red {
  background: var(--red-light);
  color: var(--red);
}

.badge.gray {
  background: #eef0ec;
  color: var(--ink-soft);
}

.badge.gold {
  background: var(--gold-light);
  color: var(--gold-dark);
}

.pagination {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-top: 0;
  background: white;
  color: var(--muted);
  font-size: 10px;
}

.pagination .page-view {
  margin-right: auto;
}

.empty-state {
  display: grid;
  min-height: 210px;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-state b {
  margin: 10px 0 5px;
  color: var(--ink-soft);
  font-family: STSong, "Songti SC", serif;
  font-size: 18px;
}

.empty-state span {
  font-size: 10px;
}

.empty-gem {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background: #fbf7ee;
  color: var(--gold-dark);
  font-family: STSong, "Songti SC", serif;
  font-size: 20px;
}

.entry-items {
  overflow: auto;
  border: 1px solid var(--line);
}

.entry-table {
  width: 100%;
  min-width: 1220px;
  border-collapse: collapse;
  font-size: 11px;
}

.entry-table th:nth-child(2),
.entry-table td:nth-child(2) {
  min-width: 104px;
}

.entry-table th:nth-child(3),
.entry-table td:nth-child(3) {
  min-width: 170px;
}

.entry-table th:nth-child(9),
.entry-table td:nth-child(9) {
  min-width: 112px;
}

.entry-table th {
  height: 35px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f3f5f1;
  color: var(--ink-soft);
  font-size: 10px;
  text-align: left;
  white-space: nowrap;
}

.entry-table td {
  border-right: 1px solid #eceee9;
  border-bottom: 1px solid #eceee9;
  padding: 4px;
}

.entry-table input,
.entry-table select {
  min-height: 29px;
  border-color: transparent;
  background: transparent;
  padding: 3px 6px;
}

.entry-table input:focus,
.entry-table select:focus {
  border-color: var(--green-600);
  background: white;
}

.entry-table .row-no {
  width: 34px;
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 14px;
  text-align: center;
}

.entry-total {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 22px;
  padding: 12px 2px 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.entry-total strong {
  margin-left: 5px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 15px;
}

.entry-total .detection-count-preview {
  color: var(--green-800);
  font-weight: 600;
}

.entry-total .detection-count-preview strong {
  color: var(--gold-dark);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(400px, 1.4fr) minmax(340px, 0.8fr);
  gap: 16px;
}

.split-layout.wide-left {
  grid-template-columns: minmax(520px, 1.7fr) minmax(360px, 0.8fr);
}

.sample-list {
  display: grid;
  gap: 7px;
}

.sample-card {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
  cursor: pointer;
}

.sample-card:hover,
.sample-card.selected {
  border-color: var(--green-600);
  background: var(--green-50);
}

.sample-card .sample-thumb {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--line);
  background: #f5f6f3;
  color: var(--muted);
  object-fit: cover;
  font-size: 9px;
}

.sample-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
}

.sample-card span {
  color: var(--muted);
  font-size: 9px;
}

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

.detail-grid .full {
  grid-column: 1 / -1;
}

.detail-list {
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #edf0ea;
  font-size: 11px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 500;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.photo-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f4f5f1;
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.photo-card footer {
  padding: 7px 8px;
  background: white;
  color: var(--muted);
  font-size: 9px;
}

.camera-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 5px;
  background:
    radial-gradient(circle, #30403d, #111a18 65%);
}

.camera-stage video,
.camera-stage canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.camera-stage canvas {
  display: none;
}

.camera-overlay {
  position: absolute;
  inset: 10%;
  border: 1px dashed rgb(255 255 255 / 30%);
  pointer-events: none;
}

.camera-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  color: rgb(255 255 255 / 45%);
  text-align: center;
}

.camera-empty b {
  margin-bottom: 5px;
  color: rgb(255 255 255 / 75%);
  font-family: STSong, "Songti SC", serif;
  font-size: 19px;
}

.camera-empty span {
  font-size: 10px;
}

.drop-zone {
  display: grid;
  min-height: 170px;
  place-content: center;
  justify-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  background: #fafbf8;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.drop-zone.dragover {
  border-color: var(--green-600);
  background: var(--green-50);
}

.drop-zone strong {
  margin: 10px 0 5px;
  color: var(--ink-soft);
}

.drop-zone span {
  font-size: 10px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 8px;
}

.permission-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcf9;
  font-size: 10px;
}

.permission-check input {
  width: 14px;
  min-height: 14px;
  accent-color: var(--green-700);
}

.association-target-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(220px, 1fr) 34px;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.association-target-row input,
.association-target-row select {
  min-height: 32px;
}

.association-status-bar {
  margin-bottom: 12px;
}

.association-status-bar .checkbox {
  font-weight: 600;
}

.association-test-panel {
  margin-bottom: 14px;
}

.association-test-result {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  background: #fafbf8;
  color: var(--muted);
  font-size: 10px;
}

.association-test-result:has(.inline-notice) {
  color: var(--ink);
}

.association-condition,
.association-result-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.association-result-line + .association-result-line {
  margin-top: 4px;
}

.association-result-line span {
  color: var(--gold);
}

.association-result-line small {
  margin-left: auto;
  color: var(--muted);
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
}

.signature-card {
  display: grid;
  justify-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fbfcf9;
  padding: 12px;
}

.signature-image {
  display: grid;
  width: 100%;
  height: 105px;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid #e7e9e3;
  background: white;
}

.signature-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.signature-card strong {
  font-size: 12px;
}

.signature-card span {
  color: var(--muted);
  font-size: 9px;
}

.label-preview-pages {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.label-preview-pages img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--line);
  background: white;
  box-shadow: var(--shadow-md);
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .page-head,
  #label-form,
  #label-mode-tabs,
  #label-preview-area > .panel-head,
  #label-help {
    display: none !important;
  }

  .app-main {
    width: 100%;
    margin: 0;
  }

  .view {
    padding: 0;
  }

  #label-preview-area,
  #label-preview-area .panel-body {
    border: 0;
    padding: 0;
    box-shadow: none;
  }

  .label-preview-pages {
    display: block;
  }

  .label-preview-pages img {
    width: 100%;
    max-width: none;
    border: 0;
    box-shadow: none;
    page-break-after: always;
  }

  .label-preview-pages img:last-child {
    page-break-after: auto;
  }
}

.chart-bars {
  display: grid;
  align-items: end;
  min-height: 220px;
  padding: 30px 10px 0;
  grid-template-columns: repeat(auto-fit, minmax(30px, 1fr));
  gap: 12px;
}

.chart-bar {
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 7px;
  height: 190px;
}

.chart-bar i {
  display: block;
  width: min(38px, 70%);
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #326f66, #14524b);
}

.chart-bar span {
  color: var(--muted);
  font-size: 8px;
  writing-mode: vertical-rl;
}

.chart-bar b {
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 500;
}

.modal {
  width: min(760px, calc(100vw - 30px));
  max-height: calc(100vh - 40px);
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  box-shadow: var(--shadow-lg);
}

.modal::backdrop {
  background: rgb(3 24 22 / 47%);
  backdrop-filter: blur(2px);
}

.modal-card {
  display: flex;
  max-height: calc(100vh - 40px);
  flex-direction: column;
  background: white;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 4px 0 0;
  font-family: STSong, "Songti SC", serif;
  font-size: 21px;
  font-weight: 600;
}

.modal-body {
  overflow: auto;
  padding: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #fafbf8;
}

.toast-stack {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(360px, calc(100vw - 44px));
  gap: 8px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green-600);
  border-radius: 5px;
  background: white;
  box-shadow: var(--shadow-md);
  font-size: 11px;
  line-height: 1.6;
  animation: toast-in 180ms ease-out;
}

.toast.error {
  border-left-color: var(--red);
}

.toast.warning {
  border-left-color: var(--amber);
}

.toast strong {
  display: block;
  margin-bottom: 2px;
}

.loading {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: rgb(248 249 246 / 62%);
  color: var(--ink-soft);
  font-size: 11px;
  backdrop-filter: blur(2px);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.section-help {
  padding: 11px 13px;
  border-left: 3px solid var(--gold);
  background: #fbf7ee;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.7;
}

.inline-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 13px;
  border: 1px solid #d8e5df;
  border-radius: 5px;
  background: var(--green-50);
  color: var(--green-800);
  font-size: 10px;
}

.inline-notice.warning {
  border-color: #ead6b1;
  background: var(--amber-light);
  color: var(--amber);
}

.code {
  border-radius: 3px;
  background: #eef1ed;
  padding: 2px 5px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
}

.progress-line {
  height: 5px;
  overflow: hidden;
  border-radius: 5px;
  background: #e8ebe6;
}

.progress-line i {
  display: block;
  height: 100%;
  background: var(--green-600);
}

.file-input {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (min-width: 1600px) {
  .stat-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .view {
    padding-right: 32px;
    padding-left: 32px;
  }
}

@media (max-width: 1280px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .filters {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .split-layout,
  .split-layout.wide-left {
    grid-template-columns: 1fr;
  }

  .quick-search {
    width: 190px;
  }
}

@media (max-width: 1320px) {
  .template-editor-layout {
    grid-template-columns: 220px minmax(360px, 1fr);
  }

  .template-property-panel {
    grid-column: 1 / -1;
  }

  .template-property-panel .panel-body {
    max-height: none;
  }

  .template-property-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

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

  .form-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .form-grid .span-4 {
    grid-column: span 3;
  }

  .quick-search,
  .work-context {
    display: none;
  }

  .template-editor-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .template-editor-toolbar .field {
    min-width: min(100%, 280px);
  }

  .template-property-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 780px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 280px;
    padding: 28px;
  }

  .login-message {
    margin: 30px 0 10px;
  }

  .login-message h1 {
    margin: 14px 0;
    font-size: 34px;
  }

  .login-features {
    display: none;
  }

  .login-panel {
    padding: 28px 18px;
  }

  .sidebar {
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar:not(.open) {
    visibility: hidden;
    pointer-events: none;
  }

  .sidebar.open {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }

  .sidebar-close,
  .menu-open {
    display: inline-grid;
  }

  .app-main {
    width: 100%;
    margin-left: 0;
  }

  .topbar {
    padding: 0 14px;
  }

  .user-chip > span:not(.user-avatar) {
    display: none;
  }

  .view {
    padding: 15px 14px 30px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .hero-stats {
    padding: 0;
  }

  .hero-stat strong {
    font-size: 24px;
  }

  .filters,
  .form-grid,
  .form-grid.three,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

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

  .template-manager-list .template-list {
    height: 360px;
  }

  .template-editor-layout {
    grid-template-columns: 1fr;
  }

  .template-object-panel,
  .template-property-panel {
    grid-column: auto;
  }

  .template-object-list {
    max-height: 280px;
  }

  .template-canvas-scroll {
    min-height: 360px;
    max-height: 620px;
    padding: 10px;
  }

  .template-editor-toolbar .toolbar-spacer {
    display: none;
  }

  .filters .wide,
  .form-grid .span-2,
  .form-grid .span-3,
  .form-grid .span-4 {
    grid-column: span 1;
  }

  .role-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .signature-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .association-target-row {
    grid-template-columns: 1fr 34px;
  }

  .association-target-row [data-target-value] {
    grid-column: 1;
  }

  .association-target-row [data-remove-target] {
    grid-row: 1 / 3;
    grid-column: 2;
  }

  .page-head {
    flex-direction: column;
  }

  .batch-entry-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-entry-hint {
    min-width: 0;
  }

  .batch-entry-tools .inline-actions {
    align-items: stretch;
  }

  .batch-entry-tools .selection-count {
    min-height: 32px;
  }

  .batch-entry-footer {
    flex-wrap: wrap;
  }

  .batch-entry-footer .small {
    order: 3;
    flex-basis: 100%;
  }

  .batch-entry-footer .button {
    margin-left: auto;
  }

  .compact-field {
    width: 100%;
  }
}
