:root {
  --bg: #f7f3ee;
  --bg-2: #fbfaf7;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-soft: #fff9f2;
  --ink: #211b1f;
  --ink-soft: #443b42;
  --muted: #746c73;
  --line: #e7ded4;
  --line-strong: #cdbda9;
  --primary: #2f7b6f;
  --primary-dark: #185f57;
  --rose: #ee7d9a;
  --rose-soft: #fff0f4;
  --mint: #bdebdc;
  --mint-soft: #eefaf5;
  --blue: #5874d8;
  --blue-soft: #eef2ff;
  --gold: #b68a4a;
  --gold-soft: #fff6df;
  --amber: #b66d22;
  --danger: #b42336;
  --danger-soft: #fff1f2;
  --shadow: 0 18px 45px rgba(35, 28, 25, 0.09);
  --shadow-soft: 0 8px 24px rgba(35, 28, 25, 0.06);
  --radius: 8px;
  --sidebar: #241f22;
  --sidebar-2: #33292f;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 245, 236, 0.88) 42%, rgba(239, 250, 245, 0.78) 100%),
    var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(33, 27, 31, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 27, 31, 0.018) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.08));
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  color: var(--rose);
}

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

img {
  max-width: 100%;
  display: block;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 34%),
    linear-gradient(160deg, var(--sidebar), var(--sidebar-2));
  color: #fff;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar::-webkit-scrollbar,
.spreadsheet-wrap::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.sidebar::-webkit-scrollbar-thumb,
.spreadsheet-wrap::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(182, 138, 74, 0.36);
  border-radius: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  min-width: 0;
  padding: 8px;
}

.brand.large {
  color: #fff;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, #ff8faf 0%, #f4c56a 48%, #8de0c9 100%);
  color: #241f22;
  font-weight: 900;
  letter-spacing: 0;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55), 0 12px 24px rgba(0, 0, 0, 0.18);
}

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

.brand strong {
  font-size: 15px;
  letter-spacing: 0;
}

.brand small {
  color: rgba(255, 255, 255, 0.62);
  margin-top: 2px;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.nav-list a {
  position: relative;
  color: rgba(255, 255, 255, 0.76);
  padding: 10px 12px 10px 30px;
  border-radius: var(--radius);
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav-list a::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.25);
}

.nav-list a:hover,
.nav-list a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(2px);
}

.nav-list a.active::before {
  background: var(--rose);
  box-shadow: 0 0 0 4px rgba(238, 125, 154, 0.18);
}

.main {
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 22px 30px;
  background: rgba(255, 252, 247, 0.84);
  border-bottom: 1px solid rgba(205, 189, 169, 0.52);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(18px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 25px;
  line-height: 1.25;
  color: var(--ink);
}

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

.user-box {
  min-width: 156px;
  text-align: right;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(205, 189, 169, 0.6);
  border-radius: var(--radius);
  padding: 9px 12px;
  box-shadow: var(--shadow-soft);
}

.user-box span,
.user-box small {
  display: block;
}

.user-box span {
  color: var(--ink);
  font-weight: 800;
}

.content {
  padding: 28px 30px 52px;
}

.menu-button {
  display: none;
}

.icon-button {
  border: 1px solid var(--line);
  background: var(--surface-solid);
  border-radius: var(--radius);
  min-width: 40px;
  min-height: 40px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 800;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease, border-color 0.14s ease;
}

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

.button.primary {
  background: linear-gradient(135deg, var(--ink), #4d3943);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 24px rgba(36, 31, 34, 0.18);
}

.button.primary:hover {
  background: linear-gradient(135deg, #3a2f35, #6c4350);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  border-color: var(--line);
}

.button.secondary:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-soft);
}

.button.tiny {
  min-height: 30px;
  padding: 4px 10px;
  background: var(--mint-soft);
  color: var(--primary-dark);
  border-color: rgba(47, 123, 111, 0.18);
}

.button-row,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.row-actions form {
  margin: 0;
}

.text-link,
.text-danger {
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  padding: 0;
  cursor: pointer;
  font-weight: 800;
}

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

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

.flash-stack {
  padding: 16px 30px 0;
}

.flash {
  border-radius: var(--radius);
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  margin-bottom: 8px;
  box-shadow: var(--shadow-soft);
}

.flash.success {
  border-color: #b7dbc7;
  background: var(--mint-soft);
}

.flash.error {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: var(--danger);
}

.panel,
.record-card,
.person-card,
.kpi-card,
.login-card {
  background: var(--surface);
  border: 1px solid rgba(231, 222, 212, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.panel.compact {
  padding: 18px;
}

.section-head,
.toolbar,
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.section-head {
  margin-bottom: 16px;
}

.section-head h2,
.card-head h2,
.panel h2 {
  margin: 0;
  font-size: 19px;
  color: var(--ink);
}

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

.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 17px;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--rose), var(--gold), var(--mint));
}

.kpi-card span,
.kpi-card small {
  display: block;
  color: var(--muted);
}

.kpi-card strong {
  display: block;
  margin: 7px 0;
  font-size: 31px;
  line-height: 1.1;
  color: var(--ink);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}

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

th {
  color: #6a5437;
  font-size: 13px;
  font-weight: 900;
  background: #fff7e9;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover {
  background: rgba(255, 240, 244, 0.48);
}

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

.clamp {
  max-width: 320px;
  max-height: 72px;
  overflow: hidden;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 9px;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: #394ca4;
  font-size: 13px;
  font-weight: 900;
  border: 1px solid rgba(88, 116, 216, 0.12);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(180, 35, 54, 0.16);
}

.badge.warning {
  background: var(--gold-soft);
  color: #8d5c12;
  border-color: rgba(182, 138, 74, 0.18);
}

.control-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.toolbar {
  margin-bottom: 16px;
  align-items: center;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(231, 222, 212, 0.78);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--rose);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(238, 125, 154, 0.16);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-weight: 800;
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-label {
  color: var(--ink-soft);
  font-weight: 800;
}

.file-input-native {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-dropzone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1.5px dashed #c2ad95;
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 22px;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.file-dropzone:hover,
.file-dropzone:focus,
.file-dropzone.drag-over {
  border-color: var(--rose);
  background: var(--rose-soft);
  box-shadow: 0 0 0 3px rgba(238, 125, 154, 0.14);
  outline: none;
}

.dropzone-copy {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.dropzone-copy strong {
  color: var(--ink);
  font-size: 17px;
}

.dropzone-copy small {
  line-height: 1.5;
}

.file-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.file-list li + li {
  margin-top: 5px;
}

.search-form input {
  max-width: 360px;
}

.search-form select {
  max-width: 190px;
}

.form-panel {
  max-width: 1180px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

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

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

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

.notice {
  border: 1px solid #efd49a;
  background: var(--gold-soft);
  color: #7d4c05;
  padding: 11px 13px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.module-tabs {
  position: sticky;
  top: 96px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 18px;
  padding: 10px;
  border: 1px solid rgba(231, 222, 212, 0.84);
  border-radius: var(--radius);
  background: rgba(255, 252, 247, 0.9);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.module-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-weight: 900;
}

.module-tabs a:hover {
  border-color: var(--rose);
  background: var(--rose-soft);
  color: var(--ink);
}

.subcategory-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 800;
}

.subcategory-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(47, 123, 111, 0.16);
  border-radius: var(--radius);
  background: var(--mint-soft);
  color: var(--primary-dark);
  font-weight: 900;
}

.subcategory-tabs a.active,
.subcategory-tabs a:hover {
  border-color: var(--primary);
  background: #dff5eb;
  color: var(--primary-dark);
}

.module-section {
  scroll-margin-top: 154px;
  margin-bottom: 24px;
}

.module-section > .table-wrap {
  max-height: 640px;
  overflow: auto;
}

.module-section > .table-wrap.panel {
  padding: 0;
}

.module-section > .table-wrap th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #fff7e9;
}

.module-section > .table-wrap table th {
  padding: 8px 9px;
  line-height: 1.25;
}

#dictionary .table-wrap table,
#catalog .table-wrap table {
  min-width: 980px;
}

#inventory .table-wrap th,
#dictionary .table-wrap th,
#catalog .table-wrap th {
  font-size: 12px;
  padding: 6px 8px;
  white-space: nowrap;
}

#inventory .table-wrap table {
  min-width: 1040px;
}

#inventory .table-wrap th:nth-child(2),
#inventory .table-wrap th:nth-child(3),
#inventory .table-wrap th:nth-child(4),
#inventory .table-wrap th:nth-child(5),
#inventory .table-wrap th:nth-child(6),
#inventory .table-wrap th:nth-child(8) {
  width: 1%;
}

.summary-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

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

.summary-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.summary-card,
.permission-card {
  border: 1px solid rgba(231, 222, 212, 0.95);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.summary-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--mint));
}

.summary-card.warning::before {
  background: linear-gradient(180deg, var(--gold), #f4c56a);
}

.summary-card.danger::before {
  background: linear-gradient(180deg, var(--danger), var(--rose));
}

.summary-card span,
.summary-card small {
  display: block;
  color: var(--muted);
}

.summary-card strong {
  display: block;
  margin: 5px 0;
  font-size: 28px;
  line-height: 1.1;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.permission-card {
  padding: 16px;
}

.permission-card h2 {
  margin: 12px 0 8px;
  font-size: 18px;
}

.permission-card p {
  margin: 0;
  color: var(--muted);
}

.package-recognition {
  display: grid;
  gap: 14px;
}

.package-upload-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(360px, 1.2fr);
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(231, 222, 212, 0.95);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.package-upload-panel h2 {
  margin: 4px 0 8px;
  font-size: 20px;
}

.package-image-dropzone {
  position: relative;
  min-height: 170px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1.5px dashed #bba88f;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fffaf2, #f0faf6);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.package-image-dropzone:hover,
.package-image-dropzone.drag-over,
.package-image-dropzone.processing {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(238, 125, 154, 0.15);
}

.package-image-dropzone.processing {
  cursor: wait;
}

.package-drop-copy {
  display: grid;
  gap: 4px;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.package-drop-copy strong {
  color: var(--ink);
  font-size: 18px;
}

.package-image-dropzone img {
  width: 100%;
  height: 190px;
  object-fit: contain;
  background: #fff;
}

.package-result {
  grid-column: 1 / -1;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(47, 123, 111, 0.22);
  border-radius: var(--radius);
  background: var(--mint-soft);
  color: var(--primary-dark);
  font-weight: 800;
}

.package-result.warning {
  border-color: #efd49a;
  background: var(--gold-soft);
  color: #7d4c05;
}

.package-result.error {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: var(--danger);
}

.package-history {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.package-history article {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
}

.package-history img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-2);
}

.package-history strong,
.package-history small {
  display: block;
}

.package-history small {
  color: var(--muted);
}

.package-history p {
  margin: 5px 0 0;
  max-height: 44px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
}

.recognized-package-strip {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid rgba(47, 123, 111, 0.2);
  border-radius: var(--radius);
  background: var(--mint-soft);
}

.recognized-package-strip img {
  width: 108px;
  height: 92px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
}

.recognized-package-strip strong,
.recognized-package-strip p {
  display: block;
  margin: 0;
}

.recognized-package-strip .badge {
  margin-top: 6px;
}

.recognized-package-strip p {
  margin-top: 7px;
  color: var(--ink-soft);
}

.placeholder-grid,
.card-grid {
  display: grid;
  gap: 16px;
}

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

.asset-placeholder,
.empty-state,
.empty-inline {
  border: 1px dashed #c9b7a4;
  border-radius: var(--radius);
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  text-align: center;
  padding: 16px;
}

.image-dropzone[data-image-dropzone] {
  position: relative;
  cursor: copy;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.image-dropzone[data-image-dropzone]::after {
  content: "拖入图片替换";
  position: absolute;
  inset: auto 8px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: rgba(36, 31, 34, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.image-dropzone[data-image-dropzone]:hover::after,
.image-dropzone[data-image-dropzone].drag-over::after,
.image-dropzone[data-image-dropzone].uploading::after {
  opacity: 1;
}

.image-dropzone.drag-over,
.image-dropzone.uploading {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(238, 125, 154, 0.16), var(--shadow-soft);
}

.image-dropzone.uploading {
  filter: saturate(0.82);
}

.image-dropzone.upload-done {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 123, 111, 0.16), var(--shadow-soft);
}

.image-dropzone.upload-failed {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 54, 0.14), var(--shadow-soft);
}

.asset-placeholder img {
  width: 100%;
  height: 100%;
  min-height: 118px;
  object-fit: cover;
}

.asset-placeholder[data-setting-key="lab_logo_path"] img {
  object-fit: contain;
  padding: 12px;
  background: #fff;
}

.empty-state {
  min-height: 180px;
}

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

.photo-upload {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 250, 242, 0.92), rgba(247, 255, 251, 0.78));
}

.photo-upload-control {
  display: grid;
  gap: 10px;
}

.photo-dropzone {
  min-height: 116px;
  padding: 18px;
}

.photo-preview {
  width: 132px;
  height: 168px;
  background: linear-gradient(135deg, #fff0f4, #eefaf5 52%, #fff8e6);
}

.upload-plus {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(168, 120, 43, 0.34);
  border-radius: 50%;
  background: var(--ink);
  color: #fffaf2;
  font-size: 26px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(43, 33, 36, 0.18);
  cursor: pointer;
}

.upload-plus:hover,
.upload-plus:focus {
  background: var(--rose);
  outline: none;
}

.person-card {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.mini-card h3 {
  margin: 0;
  font-size: 16px;
}

.avatar,
.record-media {
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff0f4, #eefaf5);
  border: 1px dashed #c9b7a4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  overflow: hidden;
}

.avatar {
  width: 110px;
  height: 140px;
}

.avatar.photo-preview {
  width: 132px;
  height: 168px;
  background: linear-gradient(135deg, #fff0f4, #eefaf5 52%, #fff8e6);
}

.avatar img,
.record-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0;
}

.tag-row span {
  background: var(--mint-soft);
  color: var(--primary-dark);
  border: 1px solid rgba(47, 123, 111, 0.12);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 800;
}

.record-list {
  display: grid;
  gap: 16px;
}

.record-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
}

.record-media {
  min-height: 150px;
}

.meta-grid,
.method-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

details {
  margin-top: 12px;
}

summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 900;
}

.method-grid h3 {
  margin: 0 0 7px;
  font-size: 15px;
  color: var(--ink);
}

.accordion-list,
.timeline {
  display: grid;
  gap: 16px;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(110px, 2fr) 32px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 10px;
  background: #efe5db;
  border-radius: var(--radius);
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--rose), var(--gold), var(--mint));
}

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.specialty-box {
  margin: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.specialty-group {
  display: none;
}

.specialty-group.active {
  display: grid;
}

.inline-review {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(110px, 1fr) auto;
  gap: 7px;
  margin-top: 8px;
}

.review-layout {
  align-items: start;
}

.review-image {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  margin: 14px 0;
}

.field-review-list {
  display: grid;
  gap: 12px;
}

.field-review {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

.field-review.low-confidence {
  border-color: #efd49a;
  background: #fffaf0;
}

.field-review.ok-confidence {
  border-color: #b7dbc7;
}

.ai-source {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.review-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.table-review-panel {
  padding: 0;
  overflow: visible;
}

.table-review-panel .section-head {
  padding: 16px 18px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.sticky-actions {
  position: static;
  z-index: auto;
}

.spreadsheet-wrap {
  overflow: scroll;
  height: clamp(420px, 58vh, 680px);
  background: #fff;
  border-top: 1px solid var(--line);
  scrollbar-gutter: stable both-edges;
}

.spreadsheet-review {
  min-width: 1800px;
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
}

.spreadsheet-review th,
.spreadsheet-review td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  background: #fff;
  min-width: 132px;
  max-width: 340px;
  vertical-align: top;
}

.spreadsheet-review thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--sidebar);
  color: #fff;
  height: 64px;
  line-height: 1.3;
  white-space: normal;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.spreadsheet-review .select-col {
  min-width: 72px;
  width: 72px;
  text-align: center;
}

.spreadsheet-review .meta-col {
  min-width: 118px;
  width: 132px;
}

.spreadsheet-review .source-col {
  min-width: 170px;
  width: 190px;
}

.spreadsheet-review .wide-col {
  min-width: 280px;
}

.spreadsheet-review .component-col {
  min-width: 136px;
}

.spreadsheet-review .metric-col {
  min-width: 150px;
}

.spreadsheet-review .summary-col {
  min-width: 300px;
}

.spreadsheet-review .pin-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fffaf3;
}

.spreadsheet-review th.pin-col {
  z-index: 7;
  background: var(--sidebar);
}

.spreadsheet-review .pin-col + .pin-col {
  left: 72px;
}

.spreadsheet-review textarea {
  min-width: 100%;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 6px;
  resize: vertical;
  line-height: 1.45;
  min-height: 42px;
}

.spreadsheet-review textarea:focus {
  outline: 2px solid rgba(238, 125, 154, 0.35);
  background: #fff;
}

.spreadsheet-review small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}

.spreadsheet-review .source-col small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.spreadsheet-review .col-kind {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  padding: 2px 6px;
  margin-bottom: 5px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff4df;
  font-size: 11px;
  font-weight: 800;
}

.spreadsheet-review .col-label {
  display: block;
  font-weight: 800;
}

.spreadsheet-review td.component-col {
  background: #f8fffb;
}

.spreadsheet-review td.metric-col {
  background: #f7fbff;
}

.spreadsheet-review td.summary-col {
  background: #fffdf9;
}

.spreadsheet-review .cell-meta {
  font-size: 11px;
}

.low-confidence-cell {
  background: #fffaf0 !important;
}

.low-confidence-cell textarea {
  background: #fffaf0;
}

.ingested-row td {
  background: #f3f1ed;
}

.required {
  color: var(--rose);
  margin-left: 2px;
}

.report-page {
  max-width: 980px;
  margin: 0 auto;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}

.report-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}

.report-header {
  text-align: center;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 18px;
  margin-bottom: 24px;
}

.report-header h1 {
  margin: 8px 0;
}

.report-sheet h2 {
  margin: 22px 0 8px;
  font-size: 18px;
}

.report-image {
  max-height: 420px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(36, 31, 34, 0.94), rgba(78, 57, 67, 0.86)),
    #241f22;
}

.login-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 22px;
  align-items: stretch;
}

.login-visual {
  color: #fff;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(238, 125, 154, 0.18), rgba(189, 235, 220, 0.1));
}

.login-visual p {
  max-width: 520px;
  font-size: 20px;
  line-height: 1.65;
  margin-top: 48px;
}

.placeholder-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
}

.placeholder-strip span {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.06);
}

.login-card {
  padding: 28px;
}

.login-card h1 {
  margin: 4px 0 22px;
}

.login-card label {
  margin-bottom: 14px;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .two-column,
  .people-grid,
  .placeholder-grid {
    grid-template-columns: 1fr;
  }

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

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

  .package-history {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: fixed;
    z-index: 20;
    transform: translateX(-102%);
    transition: transform 0.18s ease;
    width: 272px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-button {
    display: inline-flex;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 18px;
  }

  .user-box {
    grid-column: 1 / -1;
    text-align: left;
  }

  .content {
    padding: 18px;
  }

  .form-grid.two,
  .form-grid.three,
  .meta-grid,
  .method-grid,
  .report-grid,
  .login-panel,
  .inline-review,
  .field-review,
  .photo-upload,
  .file-dropzone,
  .summary-grid.five,
  .summary-grid.three {
    grid-template-columns: 1fr;
  }

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

  .package-upload-panel,
  .package-history,
  .recognized-package-strip {
    grid-template-columns: 1fr;
  }

  .module-tabs {
    position: static;
    margin-top: 0;
  }

  .span-two,
  .span-three {
    grid-column: span 1;
  }

  .record-card,
  .person-card {
    grid-template-columns: 1fr;
  }

  .record-media,
  .avatar {
    width: 100%;
    height: 180px;
  }

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

  .section-head,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-form input,
  .search-form select {
    max-width: none;
  }
}

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

  .topbar h1 {
    font-size: 20px;
  }

  .report-sheet {
    padding: 20px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .flash-stack,
  .report-actions {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .content {
    padding: 0;
  }

  .report-sheet {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}
