:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f4;
  --line: #d8e0e3;
  --text: #1d2529;
  --muted: #66767d;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --accent: #c2410c;
  --blue: #2563eb;
  --red: #dc2626;
  --green: #15803d;
  --amber: #b45309;
  --shadow: 0 10px 24px rgba(20, 35, 40, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.08), rgba(194, 65, 12, 0.05)),
    var(--bg);
}

.login-box {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.brand.big {
  color: var(--text);
  border-bottom-color: var(--line);
  padding-bottom: 18px;
}

.sidebar {
  background: #102022;
  color: #f5faf9;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  font-weight: 800;
  font-size: 21px;
}

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

.brand span {
  margin-top: 3px;
  color: #a6b9bb;
  font-size: 12px;
}

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

.nav-group-label {
  margin: 14px 10px 4px;
  color: #7fa0a3;
  font-size: 12px;
  font-weight: 700;
}

.nav-group-label:first-child {
  margin-top: 0;
}

.nav-item,
.ghost-button,
.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  transition: 0.16s ease;
}

.nav-item {
  justify-content: flex-start;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  color: #c9d8d9;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 #5eead4;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
  color: #edf7f7;
  padding: 9px 10px;
  justify-content: flex-start;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

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

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

.topbar h1 {
  margin: 0;
  font-size: 25px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  width: min(430px, 38vw);
  height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  padding: 0 14px;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.secondary-button {
  background: #e8eef0;
  color: var(--text);
  padding: 0 14px;
}

.secondary-button:hover {
  background: #dbe5e8;
}

.icon-button {
  width: 36px;
  height: 36px;
  background: #edf3f4;
  color: var(--text);
}

.icon-button:hover {
  background: #dce8eb;
}

[data-lucide] {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

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

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

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

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

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

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

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 14px;
}

.wide {
  min-height: 280px;
}

.bars {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
}

.bar-track {
  height: 12px;
  background: #e8eef0;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
}

.donut-wrap {
  min-height: 225px;
  display: grid;
  align-content: center;
  gap: 14px;
}

.donut {
  width: 138px;
  height: 138px;
  margin: 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0deg 180deg, var(--blue) 180deg 250deg, var(--amber) 250deg 300deg, var(--red) 300deg 360deg);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 28px;
  background: #fff;
  border-radius: 50%;
}

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

.legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.alert-list,
.compact-log,
.record-list,
.timeline,
.handover-items {
  display: grid;
  gap: 10px;
}

.alert {
  padding: 10px;
  border: 1px solid #f3d1a6;
  background: #fff8ed;
  border-radius: 7px;
  color: #693d08;
  line-height: 1.5;
}

.log-row,
.record,
.timeline-row,
.handover-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  background: #fbfcfc;
}

.log-row strong,
.record strong,
.timeline-row strong {
  display: block;
}

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

.danger-text {
  color: var(--red);
  font-weight: 700;
}

.overdue-card {
  border-color: #fecaca;
  background: #fff7f7;
}

.scan-layout,
.handover-layout,
.repair-layout,
.approval-layout,
.user-layout,
.production-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 14px;
}

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

.inventory-detail,
.consumable-detail,
.production-layout .wide {
  grid-column: 1 / -1;
}

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

.timeline-row button,
button.timeline-row {
  width: 100%;
  text-align: left;
}

.import-panel {
  margin-bottom: 14px;
}

.import-actions {
  display: grid;
}

.drop-upload {
  position: relative;
  min-height: 74px;
  border: 1px dashed var(--primary);
  border-radius: 7px;
  background: #f4fbfa;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
}

.drop-upload svg {
  color: var(--primary);
  flex: 0 0 auto;
}

.drop-upload span,
.drop-upload small {
  display: block;
}

.drop-upload small {
  color: var(--muted);
  margin-top: 4px;
}

.drop-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.vertical-actions {
  display: grid;
  gap: 10px;
}

.readiness-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.readiness-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
  padding: 12px;
}

.readiness-card strong,
.readiness-card span {
  display: block;
}

.readiness-card strong {
  font-size: 24px;
}

.readiness-card.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.readiness-card.warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.readiness-card.risk {
  border-color: #fecaca;
  background: #fff7f7;
}

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

.readiness-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.readiness-item.ok {
  border-left: 4px solid var(--green);
}

.readiness-item.warning {
  border-left: 4px solid var(--amber);
}

.readiness-item.risk {
  border-left: 4px solid var(--red);
}

.asset-detail-panel {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

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

.detail-grid > div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fbfcfc;
}

.detail-grid strong,
.detail-grid span {
  display: block;
}

.detail-columns section {
  min-width: 0;
}

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

.field {
  display: grid;
  gap: 6px;
}

.check-field {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.check-field input {
  width: 18px;
  height: 18px;
}

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

.field input,
.field select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #fff;
  min-width: 0;
}

.scan-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.batch-panel {
  margin-top: 14px;
}

.scanner-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

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

.scanner-field input {
  height: 52px;
  border: 2px solid var(--primary);
  border-radius: 7px;
  padding: 0 14px;
  font-size: 18px;
  background: #fbfffe;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.batch-grid h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.camera-box {
  position: relative;
  margin-top: 14px;
  background: #121b1d;
  height: 300px;
  border-radius: 8px;
  overflow: hidden;
}

.camera-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  inset: 74px 22%;
  border: 2px solid #5eead4;
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
}

.hidden {
  display: none;
}

.qr-modal {
  width: min(420px, calc(100vw - 28px));
  padding: 16px;
}

.qr-content {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.qr-content img {
  width: 260px;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.scan-preview {
  line-height: 1.7;
}

.split-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
}

.record {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.record.active {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e9eef1;
  color: var(--text);
  font-size: 12px;
}

.status-已领用 {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-库存中 {
  background: #dcfce7;
  color: #166534;
}

.status-维修中 {
  background: #fef3c7;
  color: #92400e;
}

.status-报废,
.status-遗失 {
  background: #fee2e2;
  color: #991b1b;
}

.detail-panel {
  min-height: 620px;
}

.employee-hero {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.avatar {
  width: 118px;
  height: 118px;
  border-radius: 8px;
  background: #eaf3f1;
  display: grid;
  place-items: center;
  position: relative;
}

.avatar .head {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  position: absolute;
  top: 20px;
}

.avatar .body {
  width: 62px;
  height: 44px;
  border-radius: 28px 28px 12px 12px;
  background: #203336;
  position: absolute;
  top: 68px;
}

.avatar.female .head {
  background: #be185d;
}

.avatar.female .body {
  background: #0f766e;
}

.employee-hero h2 {
  margin: 0;
  font-size: 24px;
}

.employee-meta {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-section {
  margin-top: 16px;
}

.category-section h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

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

.asset-chip {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fbfcfc;
}

.table-head {
  align-items: flex-start;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: #e8eef0;
  border-radius: 7px;
  gap: 2px;
}

.segmented button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  min-height: 31px;
  padding: 0 10px;
  color: var(--muted);
}

.segmented button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(10, 20, 22, 0.08);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

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

.small-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  min-height: 30px;
  padding: 0 9px;
}

.full {
  width: 100%;
  margin-top: 14px;
}

.summary-box {
  line-height: 1.8;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  text-align: center;
  padding: 18px;
}

.modal {
  width: min(720px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 25, 28, 0.24);
}

.modal::backdrop {
  background: rgba(9, 16, 18, 0.44);
}

.modal form {
  padding: 16px;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.modal-head h2 {
  margin: 0;
}

.modal-actions {
  margin-top: 16px;
  justify-content: flex-end;
  padding: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #102022;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.18s ease;
  max-width: 360px;
}

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

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px;
  }

  .brand,
  .sidebar-foot {
    display: none;
  }

  .nav {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .nav-group-label {
    align-self: center;
    margin: 0 6px;
    white-space: nowrap;
  }

  .nav-item {
    white-space: nowrap;
  }

  .topbar,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .metric-grid,
  .dashboard-grid,
  .scan-layout,
  .split-layout,
  .handover-layout,
  .production-layout,
  .scan-grid,
  .form-grid,
  .detail-grid,
  .detail-columns,
  .batch-grid {
    grid-template-columns: 1fr;
  }

  .employee-hero {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 14px;
  }

  .scanner-field input {
    height: 58px;
    font-size: 20px;
  }

  .scan-actions,
  .row-actions {
    flex-wrap: wrap;
  }

  .scan-actions > *,
  .row-actions > * {
    flex: 1 1 140px;
  }

  .readiness-summary {
    grid-template-columns: 1fr;
  }

  .readiness-item {
    align-items: flex-start;
    flex-direction: column;
  }
}
