:root {
  --bg: #f6f5f2;
  --ink: #1e2930;
  --muted: #66747d;
  --line: #d9dedc;
  --panel: #ffffff;
  --primary: #176b6b;
  --primary-strong: #0f4e52;
  --accent: #c86b3c;
  --ok: #237a57;
  --warn: #bb7a15;
  --danger: #b9443f;
  --shadow: 0 16px 42px rgba(37, 48, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f0;
}

.login-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 28px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

.login-brand h1,
.login-brand p {
  margin: 0;
}

.login-brand h1 {
  margin: 4px 0;
  font-size: 25px;
}

.login-brand > div > p:last-child {
  color: var(--muted);
}

.login-logo {
  width: 112px;
  height: 64px;
  flex: 0 0 auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-form {
  display: grid;
  gap: 14px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.qr-public-page {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 28px 16px;
  background: #f6f5f2;
}

.qr-public-card {
  width: min(680px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.qr-public-card h1,
.qr-public-card h2,
.qr-public-card p {
  margin: 0;
}

.qr-public-card h1 {
  font-size: 28px;
  line-height: 1.25;
}

.qr-public-card h2 {
  font-size: 18px;
}

.qr-public-meta,
.qr-public-empty,
.qr-public-list small {
  color: var(--muted);
}

.qr-public-section {
  display: grid;
  gap: 10px;
}

.qr-public-photo {
  width: 100%;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.qr-public-photo img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #fff;
}

.qr-public-photo-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.qr-public-photo-controls button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #e2efec;
  color: var(--primary-strong);
  font-weight: 700;
}

.qr-public-photo-controls span {
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.qr-public-location {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.qr-public-location strong {
  color: var(--primary-strong);
  font-size: 18px;
}

.qr-public-location span,
.qr-public-location small {
  color: var(--muted);
}

.qr-public-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.qr-public-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.photo-scan-mode .scanner-panel .scan-box {
  display: none;
}

.photo-scan-mode .scanner-panel .scan-trigger {
  background: #e1ece9;
  color: var(--primary-strong);
  border-color: transparent;
  font-weight: 700;
}

.qr-public-list small {
  grid-column: 1 / -1;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

.sidebar-column {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #102a32;
  color: #f4faf8;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar {
  padding: 22px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.brand-mark {
  flex: 0 0 auto;
  width: 82px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 6px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand h1,
.topbar h2,
.topbar p,
.panel h3 {
  margin: 0;
}

.brand h1 {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-btn,
.secondary-btn,
.primary-btn,
.danger-btn,
.segment,
.link-btn {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
}

.nav-item {
  text-align: left;
  color: #deeeee;
  background: transparent;
  padding: 0 14px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 22px 18px;
}

.account-summary {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.account-summary small {
  color: #b8cdcf;
}

.user-create-grid,
.password-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

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

.user-table {
  margin-top: 18px;
}

body[data-user-role="user"] .admin-only,
body[data-user-role="user"] #selectAllAssetsBtn,
body[data-user-role="user"] #deleteSelectedAssetsBtn,
body[data-user-role="user"] #importBtn,
body[data-user-role="user"] #exportAllBtn,
body[data-user-role="user"] #addLocationBtn,
body[data-user-role="user"] #selectAllLocationsBtn,
body[data-user-role="user"] #deleteSelectedLocationsBtn,
body[data-user-role="user"] [data-delete-asset],
body[data-user-role="user"] [data-edit-location],
body[data-user-role="user"] [data-delete-location],
body[data-user-role="user"] [data-delete-project],
body[data-user-role="user"] [data-restore-project],
body[data-user-role="user"] [data-permanent-delete-project],
body[data-user-role="user"] [data-delete-category] {
  display: none !important;
}

.project-manager-field select {
  min-height: 112px;
}

.project-manager-field small {
  display: block;
  margin-top: 6px;
}

.main {
  padding: 26px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: 28px;
  margin-top: 4px;
}

.top-actions,
.toolbar,
.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.time-display {
  min-width: 190px;
  min-height: 42px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: right;
}

.time-display span {
  color: var(--muted);
  font-size: 12px;
}

.time-display strong {
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.primary-btn {
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--primary-strong);
}

.secondary-btn {
  padding: 0 14px;
  background: #e1ece9;
  color: var(--primary-strong);
  font-weight: 700;
}

.danger-btn {
  padding: 0 14px;
  background: #f7e2df;
  color: var(--danger);
  font-weight: 800;
}

.danger-btn:hover {
  background: #f1cbc7;
}

.ghost-btn {
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.main .ghost-btn {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.link-btn {
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}

.full {
  width: 100%;
}

.is-hidden {
  display: none !important;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel,
.asset-card,
.location-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.dashboard-search-panel {
  margin-bottom: 18px;
}

.dashboard-search-panel .panel-head {
  align-items: flex-start;
}

.dashboard-search-box {
  margin-bottom: 12px;
}

.dashboard-search-box input {
  min-height: 46px;
  font-size: 15px;
}

.dashboard-search-results {
  min-height: 56px;
}

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

.search-result-columns section {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.search-result-columns h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.search-result-item {
  width: 100%;
  min-height: auto;
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.search-result-item:hover,
.search-result-item.suggestion {
  border-color: rgba(23, 107, 107, 0.45);
  background: #eef8f3;
}

.search-result-item strong {
  overflow-wrap: anywhere;
}

.search-result-item small,
.search-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.search-empty {
  padding: 11px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.project-summary-record {
  gap: 8px;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  background: #e1ece9;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.two-column,
.workflow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.panel {
  padding: 18px;
}

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

.record-list,
.cart-list,
.audit-result,
.project-list {
  display: grid;
  gap: 10px;
}

.record,
.cart-item,
.qr-bind {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.record small,
.cart-item small,
.qr-bind small,
.asset-meta,
.helper {
  color: var(--muted);
}

.scan-result {
  margin-bottom: 10px;
}

.scan-ok {
  border-color: rgba(35, 122, 87, 0.35);
  background: #eef8f3;
}

.project-panel {
  margin-bottom: 16px;
}

.project-board {
  display: grid;
  gap: 16px;
}

.active-project-info {
  margin-bottom: 12px;
}

.project-picker {
  margin-top: 10px;
}

.project-picker-table {
  display: grid;
  gap: 8px;
}

.project-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 18px rgba(37, 48, 54, 0.06);
}

.project-actions {
  margin-bottom: 14px;
}

.project-picker-row:hover,
.project-picker-row.active {
  border-color: rgba(23, 107, 107, 0.5);
  background: #eef8f3;
}

.project-picker-row > div:first-child {
  display: grid;
  gap: 5px;
}

.project-picker-row small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.project-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.project-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.project-detail h3,
.project-detail p {
  margin: 0;
}

.project-detail p {
  color: var(--muted);
  margin-top: 6px;
}

.project-counts {
  min-width: 132px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  padding: 12px;
  border-radius: 8px;
  background: #eef8f3;
  text-align: center;
}

.project-counts strong {
  font-size: 24px;
  color: var(--primary-strong);
}

.project-counts small {
  color: var(--muted);
}

.project-assets {
  max-height: none;
}

.project-subtitle {
  margin: 16px 0 10px;
}

.project-material-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.project-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.project-section-head h4 {
  margin: 0;
}

.project-section-head small {
  color: var(--muted);
}

.project-material-entry {
  display: grid;
  gap: 6px;
  overflow-x: auto;
  overflow-y: visible;
}

.project-material-add {
  display: grid;
  grid-template-columns: 64px 130px minmax(280px, 1.4fr) minmax(260px, 1.2fr) 78px 74px 78px 74px 130px 130px minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 1760px;
}

.project-material-add-head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.project-material-add-head span {
  padding: 0 4px;
}

.project-material-index {
  display: grid;
  place-items: center;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--primary-strong);
}

.project-name-inputs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  min-width: 0;
}

.project-asset-suggestions {
  position: fixed;
  z-index: 1000;
  top: var(--suggest-top, 0);
  left: var(--suggest-left, 0);
  width: var(--suggest-width, 320px);
  display: none;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(23, 107, 107, 0.2);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(25, 45, 50, 0.14);
}

.project-asset-suggestions:not(:empty) {
  display: grid;
}

.project-asset-suggestions button {
  width: 100%;
  min-height: 0;
  padding: 8px 10px;
  border: 1px solid rgba(23, 107, 107, 0.22);
  border-radius: 8px;
  background: #f7fbf9;
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.project-asset-suggestions button:hover {
  border-color: rgba(23, 107, 107, 0.55);
  background: #eef8f3;
}

.project-asset-suggestions strong,
.project-asset-suggestions small {
  display: block;
  line-height: 1.35;
}

.project-asset-suggestions small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.project-asset-suggestions > small {
  margin: 0;
  padding: 8px 10px;
}

.project-material-table {
  overflow-x: auto;
}

.project-material-table table {
  min-width: 1500px;
}

.project-excel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.project-material-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.project-material-note span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.project-material-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.project-material-summary span {
  padding: 6px 10px;
  border-radius: 8px;
  background: #e8f1ef;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
}

.mini-btn {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.project-map-panel {
  background: #fff;
}

.project-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 14px;
  align-items: start;
}

.project-map-canvas {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  cursor: crosshair;
}

.project-map-canvas img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.project-map-region {
  position: absolute;
  display: block;
  padding: 4px;
  border: 2px solid rgba(16, 121, 116, 0.8);
  border-radius: 6px;
  background: rgba(16, 121, 116, 0.16);
  color: var(--primary-strong);
  font-weight: 900;
  cursor: pointer;
}

.project-map-region span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 8px);
  max-height: calc(100% - 8px);
  padding: 2px 5px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(10, 41, 39, 0.12);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: hidden;
  pointer-events: none;
}

.project-map-region.active,
.project-map-region:hover {
  border-color: #d96a3a;
  background: rgba(217, 106, 58, 0.22);
  box-shadow: 0 0 0 4px rgba(217, 106, 58, 0.12);
}

.project-map-draft {
  position: absolute;
  z-index: 4;
  border: 2px dashed #d96a3a;
  border-radius: 6px;
  background: rgba(217, 106, 58, 0.18);
  box-shadow: 0 0 0 4px rgba(217, 106, 58, 0.1);
  pointer-events: none;
}

.project-map-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #f8faf9;
}

.project-map-side {
  display: grid;
  gap: 12px;
}

.project-public-card,
.project-section-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

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

.project-section-list > strong,
.project-section-list > small {
  grid-column: 1 / -1;
}

.project-public-card small,
.project-public-url,
.project-section-list small {
  color: var(--muted);
}

.project-public-url {
  overflow-wrap: anywhere;
}

.project-public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-section-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-section-chip.active {
  border-color: var(--primary);
  background: #edf7f3;
}

.project-section-chip button {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--primary-strong);
  font-weight: 900;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-section-chip .chip-remove {
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fde7e4;
  color: var(--danger);
}

.public-map-canvas {
  cursor: default;
}

.public-material-group {
  display: grid;
  gap: 8px;
}

.guide-group {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.guide-group strong {
  color: var(--primary-strong);
}

.guide-group small,
.purchase-record small {
  color: var(--muted);
}

.toolbar {
  margin-bottom: 14px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segment {
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: #e1ece9;
  color: var(--primary-strong);
}

.toolbar select {
  max-width: 210px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.asset-card {
  overflow: hidden;
}

.asset-image {
  position: relative;
  height: 150px;
  background: #dbe7e3;
  display: grid;
  place-items: center;
  color: #456368;
  font-weight: 800;
  background-size: cover;
  background-position: center;
}

.asset-photo-nav,
.image-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  background: rgba(16, 42, 50, 0.72);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.asset-photo-prev,
.image-nav-prev {
  left: 10px;
}

.asset-photo-next,
.image-nav-next {
  right: 10px;
}

.asset-photo-count,
.image-counter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(16, 42, 50, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.asset-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.asset-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.asset-title h3 {
  min-width: 0;
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: max-content;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf2f0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  background: #dff1e9;
  color: var(--ok);
}

.badge.warn {
  background: #fff0d7;
  color: var(--warn);
}

.badge.danger {
  background: #f9dfdd;
  color: var(--danger);
}

.asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.floating-check {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 20px;
  min-height: 20px;
  accent-color: var(--primary);
}

.cart-item {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 12px;
}

.cart-item strong,
.cart-item small {
  grid-column: 2;
}

.cart-item button {
  grid-row: 1 / span 3;
  grid-column: 3;
}

.cart-index {
  grid-row: 1 / span 3;
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 64px;
  padding: 0 10px;
  border-radius: 8px;
  background: #e1ece9;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.scanner-panel video {
  width: 100%;
  max-height: 260px;
  display: none;
  border-radius: 8px;
  background: #111;
}

.scan-box {
  min-height: 170px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  margin: 14px 0;
  overflow: hidden;
  background: #fbfcfb;
}

.scan-hint {
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.scanner-entry {
  display: grid;
  gap: 10px;
}

.scanner-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.scanner-actions button {
  min-width: 132px;
  min-height: 42px;
  padding: 0 16px;
}

.audit-entry {
  margin-top: 10px;
}

.audit-actions #finishAuditBtn {
  min-width: 176px;
}

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

.settings-panel {
  max-width: 760px;
}

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

.deleted-project-list {
  display: grid;
  gap: 10px;
}

.deleted-project-record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.deleted-project-record > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.deleted-project-record strong,
.deleted-project-record small {
  overflow-wrap: anywhere;
}

.deleted-project-record small {
  color: var(--muted);
}

.settings-form,
.category-manager {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.settings-form .input-row,
.category-manager .input-row {
  gap: 8px;
  flex-wrap: nowrap;
}

.settings-form .input-row input,
.category-manager .input-row input {
  min-width: 0;
}

.settings-form .input-row button,
.category-manager .input-row button {
  flex: 0 0 auto;
}

.category-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  max-width: 100%;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.category-chip span {
  overflow-wrap: anywhere;
}

.category-chip button {
  width: 22px;
  height: 22px;
  min-height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: #f7e2df;
  color: var(--danger);
  font-weight: 900;
}

.qr-bind {
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.2fr);
  align-items: center;
}

.qr-bind > div:first-child {
  display: grid;
  gap: 6px;
}

.image-bind {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  align-items: start;
}

.unit-code-bind {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  min-width: 0;
  overflow: hidden;
}

.unit-code-copy {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.unit-code-copy strong {
  font-size: 15px;
  flex: 0 0 auto;
}

.accessory-bind {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.accessory-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.accessory-head strong {
  display: block;
  margin-bottom: 6px;
}

.accessory-head small {
  color: var(--muted);
}

.accessory-list {
  display: grid;
  gap: 8px;
}

.accessory-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 92px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.accessory-check-list {
  grid-column: 2;
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.accessory-check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.accessory-check-list input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--primary);
}

.unit-code-copy small {
  max-width: 430px;
}

.unit-code-bind small,
.unit-qr-panel small {
  color: var(--muted);
  line-height: 1.55;
}

.unit-code-example {
  width: max-content;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  background: #e1ece9;
  color: var(--primary-strong) !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.unit-code-main {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.unit-code-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unit-code-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.unit-code-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.unit-code-item span {
  overflow-wrap: anywhere;
}

.unit-code-item.active,
.unit-code-item:hover {
  border-color: rgba(23, 107, 107, 0.5);
  background: #eef8f3;
}

.unit-code-item small {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  white-space: nowrap;
}

.unit-code-workbench {
  display: grid;
  grid-template-columns: minmax(210px, 0.95fr) minmax(240px, 1.05fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.unit-code-workbench:has(.unit-code-list.is-hidden) {
  grid-template-columns: 1fr;
}

.unit-qr-panel {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 150px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.unit-qr-panel img {
  width: 108px;
  height: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.unit-qr-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
  align-content: start;
}

.unit-qr-copy strong {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  line-height: 1.35;
}

.unit-qr-copy .qr-actions {
  margin-top: 4px;
}

.image-bind small {
  color: var(--muted);
}

.asset-image-tools {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.asset-image-preview-box {
  position: relative;
  width: 100%;
  min-height: 190px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.image-nav-btn {
  z-index: 2;
}

.asset-image-preview-box:not(.has-images) .image-nav-btn,
.asset-image-preview-box:not(.has-images) .image-counter {
  display: none;
}

#assetImagePreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#assetImagePreview.is-empty,
#assetImagePreview.is-broken {
  display: none;
}

.image-empty-state {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.image-thumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-thumb {
  width: 58px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.image-thumb.active {
  border-color: var(--primary);
}

.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-thumb-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.asset-image-preview-box:has(#assetImagePreview:not(.is-empty):not(.is-broken)) .image-empty-state {
  display: none;
}

.asset-camera {
  width: 100%;
  max-height: 260px;
  border-radius: 8px;
  background: #111;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 40px;
  font-size: 14px;
  line-height: 1;
}

.file-btn input {
  display: none;
}

.qr-preview {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.qr-preview img {
  width: 112px;
  height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.qr-actions .primary-btn,
.qr-actions .secondary-btn,
.qr-actions .ghost-btn,
.qr-actions .file-btn {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.wide,
.stacked {
  grid-column: 1 / -1;
}

.location-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
}

.location-visual-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(430px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.location-card-pane {
  min-width: 0;
}

.location-card {
  position: relative;
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.location-card.is-plan-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 107, 0.14), var(--shadow);
  transform: translateY(-2px);
}

.location-card-check {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 20px;
  min-height: 20px;
  accent-color: var(--primary);
}

.location-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding-left: 30px;
}

.location-card-head strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.location-card-head small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.location-count {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 8px;
  background: #e1ece9;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.location-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--primary);
}

.floor-plan-panel {
  position: sticky;
  top: 18px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.floor-plan-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f6;
}

.floor-plan-tabs button {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.floor-plan-tabs button.active {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 2px 8px rgba(37, 48, 54, 0.1);
}

.floor-plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.floor-plan-head > div {
  display: grid;
  gap: 4px;
}

.floor-plan-head strong {
  font-size: 18px;
}

.floor-plan-head small {
  color: var(--muted);
}

.floor-plan-head > span {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 8px;
  background: #e1ece9;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.floor-plan-canvas {
  display: grid;
  place-items: center;
  min-height: 520px;
  max-height: calc(100vh - 245px);
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.floor-plan-canvas svg {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: calc(100vh - 270px);
}

.room-outline {
  fill: #fff;
  stroke: #24373d;
  stroke-width: 10;
  stroke-linejoin: round;
}

.door-mark {
  fill: none;
  stroke: #94a4a6;
  stroke-width: 7;
  stroke-linecap: round;
}

.floor-shelf {
  cursor: default;
  outline: none;
}

.floor-shelf rect {
  fill: #f4f7f6;
  stroke: #a9b7b7;
  stroke-width: 2;
  transition: fill 160ms ease, stroke 160ms ease, filter 160ms ease;
}

.floor-shelf text {
  fill: #52656a;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0;
  pointer-events: none;
}

.floor-shelf.is-bound rect {
  fill: #e4f0ed;
  stroke: #75aaa3;
}

.floor-shelf.is-bound text {
  fill: var(--primary-strong);
}

.floor-shelf.is-active rect,
.floor-shelf:focus rect {
  fill: var(--primary);
  stroke: #0e5557;
  stroke-width: 5;
  filter: drop-shadow(0 8px 10px rgba(23, 107, 107, 0.3));
}

.floor-shelf.is-active text,
.floor-shelf:focus text {
  fill: #fff;
}

.location-room-empty {
  grid-column: 1 / -1;
}

.location-qr-bind {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.2fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.location-qr-bind small,
.detail-summary small {
  color: var(--muted);
}

.location-qr-preview {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.location-qr-preview img {
  width: 112px;
  height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-summary {
  margin: 12px 0;
}

.location-detail-table {
  max-height: 420px;
}

.label-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.label-card {
  min-height: 246px;
  border: 1px dashed #7c8b8e;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.label-card img {
  width: 132px;
  height: 132px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  font-size: 13px;
}

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

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

td .badge {
  white-space: nowrap;
}

td input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
}

dialog {
  width: min(780px, calc(100vw - 30px));
  max-height: 88vh;
  overflow: auto;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(16, 42, 50, 0.45);
}

.modal-form {
  position: relative;
  padding: 8px;
}

.modal-close {
  position: sticky;
  top: 0;
  z-index: 5;
  float: right;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(37, 48, 54, 0.12);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 14px;
  background: #102a32;
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1250px) {
  .location-visual-layout {
    grid-template-columns: 1fr;
  }

  .floor-plan-panel {
    position: static;
  }

  .floor-plan-canvas {
    max-height: 720px;
  }

  .floor-plan-canvas svg {
    max-height: 680px;
  }
}

@media (max-width: 920px) {
  .app-shell {
    display: flex;
    min-height: 100svh;
    flex-direction: column;
  }

  .sidebar-column {
    display: contents;
  }

  .sidebar {
    position: static;
    height: auto;
    order: 1;
    gap: 14px;
    padding: 14px 18px 16px;
    background: #102a32;
    color: #f4faf8;
  }

  .brand {
    width: fit-content;
    max-width: 100%;
    padding-right: 18px;
  }

  .sidebar-footer {
    order: 3;
    margin-top: 0;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
    background: #102a32;
    color: #f4faf8;
  }

  .main {
    order: 2;
    flex: 1 0 auto;
    padding: 18px;
  }

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

  .scanner-actions button {
    width: 100%;
    min-width: 0;
  }

  .audit-actions #finishAuditBtn {
    min-width: 0;
  }

  .location-board {
    grid-template-columns: 1fr;
  }

  .floor-plan-canvas {
    min-height: 460px;
  }

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

  .nav-item {
    text-align: center;
  }

  .search-result-columns,
  .two-column,
  .workflow,
  .project-detail-head,
  .form-grid,
  .unit-code-bind,
  .unit-code-workbench,
  .image-bind,
  .location-qr-bind,
  .qr-bind,
  .project-section-list,
  .user-create-grid,
  .password-form {
    grid-template-columns: 1fr;
  }

  .login-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .project-section-head {
    display: grid;
  }

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

  .project-material-add {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .project-material-add-head {
    display: none;
  }

  .project-name-inputs {
    grid-template-columns: 1fr;
  }

  .unit-qr-panel {
    grid-template-columns: 1fr;
  }

  .accessory-head,
  .accessory-row {
    grid-template-columns: 1fr;
  }

  .accessory-head {
    display: grid;
  }

  .accessory-check-list {
    grid-column: auto;
  }

  .qr-preview,
  .location-qr-preview {
    justify-content: flex-start;
  }

  .cart-item {
    grid-template-columns: 1fr;
  }

  .project-picker-row {
    grid-template-columns: 1fr;
  }

  .cart-item strong,
  .cart-item small,
  .cart-item button,
  .cart-index {
    grid-column: auto;
    grid-row: auto;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: row;
    gap: 12px;
    margin-bottom: 16px;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar h2 {
    font-size: 26px;
  }

  .top-actions {
    max-width: 158px;
    margin-left: auto;
    justify-content: flex-end;
  }

  .time-display {
    min-width: 138px;
    min-height: 52px;
    padding: 5px 9px;
  }

  .time-display span {
    font-size: 11px;
  }

  .time-display strong {
    font-size: 15px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }

  .metric {
    min-height: 104px;
    padding: 14px;
  }

  .metric strong {
    margin-top: 5px;
    font-size: 27px;
  }

  .settings-form .input-row,
  .category-manager .input-row {
    flex-wrap: wrap;
  }

  .settings-form .input-row button,
  .category-manager .input-row button {
    width: 100%;
  }

  .deleted-project-record {
    align-items: stretch;
    flex-direction: column;
  }

  .deleted-project-record .row-actions button {
    flex: 1 1 auto;
  }
}

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

  .sidebar,
  .sidebar-footer,
  .topbar,
  .toolbar,
  .view:not(#labels) {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
    padding: 0;
  }

  #labels {
    display: block !important;
  }

  .label-sheet {
    grid-template-columns: repeat(3, 1fr);
  }

  .label-card {
    box-shadow: none;
    page-break-inside: avoid;
  }
}
