:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --ink: #17212b;
  --muted: #607080;
  --line: #d9e1e8;
  --brand: #116b6f;
  --brand-dark: #0b4d50;
  --accent: #b63f32;
  --good: #1f7a4f;
  --warn: #936215;
  --shadow: 0 18px 50px rgba(25, 39, 52, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hidden {
  display: none !important;
}

.role-hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #eef3fb;
}

.login-panel {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-block.compact h1 {
  font-size: 22px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

.brand-block p,
.hint,
.dialog-subtitle {
  color: var(--muted);
}

.login-form {
  margin-top: 30px;
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input[type="file"] {
  padding: 8px 10px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 107, 111, 0.16);
}

.primary,
.ghost,
.danger,
.icon-btn {
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 14px;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-dark);
}

.ghost {
  background: #e7edf1;
  color: var(--ink);
}

.danger {
  background: #f5dfdc;
  color: #8f2e25;
}

.icon-btn {
  min-width: 38px;
  padding: 0 10px;
  background: #edf2f5;
  color: var(--ink);
  font-size: 22px;
}

.hint {
  font-size: 13px;
  line-height: 1.6;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #e7edf1;
  border-radius: 8px;
}

.tabs button {
  min-width: 72px;
  min-height: 34px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(20, 34, 44, 0.12);
}

.page-band {
  max-width: 1500px;
  margin: 0 auto;
  padding: 22px 24px 34px;
}

.notice-panel {
  max-width: 1500px;
  margin: 18px auto 0;
  padding: 0 24px;
  display: grid;
  gap: 8px;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.notice.warn {
  border-color: #efd49b;
  background: #fff8e8;
}

.notice.danger {
  border-color: #e6b8b1;
  background: #fff0ee;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.action-menu {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-start;
}

.action-menu > summary,
.action-submenu > summary {
  list-style: none;
  cursor: pointer;
}

.action-menu > summary::-webkit-details-marker,
.action-submenu > summary::-webkit-details-marker {
  display: none;
}

.action-menu > summary::after {
  content: " v";
  margin-left: 8px;
  font-size: 13px;
}

.action-menu[open] > summary::after {
  content: " ^";
}

.action-menu-list {
  position: absolute;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 4px;
  min-width: 180px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(20, 34, 44, 0.16);
}

.action-menu:not([open]) .action-menu-list {
  display: none;
}

.action-menu-list button,
.action-submenu > summary {
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.action-submenu {
  position: relative;
}

.action-submenu > summary {
  display: flex;
  min-height: 38px;
  align-items: center;
  border-radius: 6px;
  padding: 8px 14px;
}

.action-submenu > summary::after {
  content: " >";
  margin-left: auto;
  font-size: 13px;
}

.action-submenu[open] > summary::after {
  content: " <";
}

.action-submenu-list {
  position: absolute;
  top: 0;
  left: calc(100% + 8px);
  z-index: 21;
  display: grid;
  gap: 4px;
  min-width: 168px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(20, 34, 44, 0.16);
}

.action-submenu:not([open]) .action-submenu-list {
  display: none;
}

.action-menu-list button:hover,
.action-submenu > summary:hover {
  background: #eef4f5;
}

.filter-group {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 220px) auto;
  align-items: center;
  gap: 10px;
}

.filter-group.two {
  grid-template-columns: minmax(240px, 1fr) auto;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.checkline input {
  width: 17px;
  height: 17px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stats-row div {
  display: grid;
  gap: 3px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats-row b {
  font-size: 25px;
  line-height: 1;
}

.stats-row span {
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(22, 37, 48, 0.06);
}

table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: #415262;
  font-weight: 700;
}

td {
  background: #fff;
}

tr:hover td {
  background: #f8fbfc;
}

.part-name {
  font-weight: 700;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
}

.qty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 26px;
  border-radius: 6px;
  background: #eaf5f1;
  color: var(--good);
  font-weight: 700;
}

.qty.empty {
  background: #f7e5e2;
  color: #a93443;
}

.qty.low {
  background: var(--accent-soft);
  color: #8a6107;
}

.level {
  display: inline-block;
  min-width: 70px;
  border-radius: 6px;
  padding: 5px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  background: #edf2f5;
  color: #415262;
}

.level.low {
  background: #e8f1fb;
  color: #245784;
}

.level.common {
  background: #eaf5f1;
  color: var(--good);
}

.level.key {
  background: #fff0d2;
  color: var(--warn);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions button {
  min-height: 32px;
  border-radius: 6px;
  padding: 6px 10px;
  background: #edf2f5;
  color: var(--ink);
}

.row-actions .primary {
  background: var(--brand);
  color: #fff;
}

.row-actions .danger {
  background: #f5dfdc;
  color: #8f2e25;
}

.status {
  display: inline-block;
  min-width: 60px;
  border-radius: 999px;
  padding: 4px 9px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.status.pending {
  background: #fff0d2;
  color: var(--warn);
}

.status.approved {
  background: #dff1e8;
  color: var(--good);
}

.status.rejected {
  background: #f3dedb;
  color: #8f2e25;
}

.status.exported {
  background: #e8f1fb;
  color: #245784;
}

.status.cancelled {
  background: #ece8e2;
  color: #665747;
}

.status.returned {
  background: #e4eaf0;
  color: #4d5d6c;
}

.import-history {
  display: grid;
  gap: 8px;
  white-space: normal;
}

.import-record {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.import-record b {
  font-family: Consolas, monospace;
  color: var(--brand);
}

.import-record em,
.import-record small {
  font-style: normal;
  color: var(--muted);
}

.credit {
  display: inline-block;
  min-width: 70px;
  border-radius: 6px;
  padding: 5px 8px;
  background: #eaf5f1;
  color: var(--good);
  font-weight: 700;
}

.code-cell {
  max-width: 180px;
  max-height: 80px;
  overflow: auto;
  font-family: Consolas, monospace;
  font-size: 12px;
}

dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(18, 32, 42, 0.45);
}

.dialog-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: var(--panel);
}

.dialog-panel.narrow {
  width: min(520px, calc(100vw - 32px));
}

.dialog-panel.import-panel {
  width: min(1280px, calc(100vw - 32px));
}

.dialog-panel header,
.dialog-panel footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-panel footer {
  justify-content: flex-end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.compact {
  gap: 10px;
}

.import-upload {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.summary-line {
  min-height: 24px;
}

.verification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.verification-row button {
  white-space: nowrap;
}

#importPreviewWrap {
  max-height: 58vh;
}

#importPreviewWrap table {
  min-width: 1240px;
}

#importPreviewWrap input,
#importPreviewWrap select {
  min-width: 120px;
  padding: 7px 8px;
}

#userImportResultWrap {
  max-height: 48vh;
}

#userImportResultWrap table {
  min-width: 920px;
}

.import-created td:nth-last-child(2) {
  color: #0f766e;
  font-weight: 700;
}

.import-skipped td:nth-last-child(2) {
  color: #8a5a00;
  font-weight: 700;
}

.import-failed td:nth-last-child(2) {
  color: #b42318;
  font-weight: 700;
}

#archiveItemSelect {
  min-height: 150px;
}

.wide {
  grid-column: 1 / -1;
}

.image-upload {
  align-content: start;
}

.image-upload .ghost {
  justify-self: start;
  margin-top: 2px;
}

.image-preview {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 76px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.image-preview img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.image-preview span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.detail-item.wide {
  grid-column: 1 / -1;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-item a {
  color: var(--brand-dark);
}

.detail-image img {
  display: block;
  max-width: min(100%, 520px);
  max-height: 360px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 6px;
  padding: 5px 8px;
  background: #edf2f5;
  color: #334554;
  font-family: Consolas, monospace;
  font-size: 12px;
}

.code-pill button {
  min-height: 24px;
  border-radius: 5px;
  padding: 3px 7px;
  background: #ffffff;
  color: var(--brand-dark);
}

.code-pill.available {
  background: #eaf5f1;
  color: var(--good);
}

.code-pill.borrowed,
.code-pill.installed {
  background: #fff0d2;
  color: var(--warn);
}

.code-pill.lost,
.code-pill.damaged {
  background: #f3dedb;
  color: #8f2e25;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.device-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.device-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.device-card header div:first-child {
  display: grid;
  gap: 4px;
}

.device-card span,
.device-card p {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 8;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17212b;
  color: #fff;
  box-shadow: var(--shadow);
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .tabs {
    overflow-x: auto;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-group {
    grid-template-columns: 1fr;
  }

  .import-upload {
    grid-template-columns: 1fr;
  }

  .action-menu-list {
    left: 0;
    right: auto;
  }

  .action-submenu-list {
    position: static;
    margin-top: 4px;
    box-shadow: none;
  }

  .stats-row,
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .page-band {
    padding: 16px 12px 28px;
  }
}

/* 2026-06-24 UI redesign: Nuclear Fusion Robot Lab asset console */
:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-soft: #f7f9fd;
  --ink: #17233d;
  --muted: #6d7890;
  --line: #dfe5ef;
  --brand: #315fae;
  --brand-dark: #182c67;
  --brand-soft: #eaf1ff;
  --accent: #f2c94c;
  --accent-soft: #fff7d7;
  --good: #198564;
  --warn: #9a6810;
  --danger: #b53e4c;
  --shadow: 0 18px 48px rgba(28, 48, 92, 0.1);
  --shadow-soft: 0 8px 24px rgba(28, 48, 92, 0.07);
  --radius: 12px;
}

html {
  background: var(--bg);
}

body {
  background:
    radial-gradient(circle at 88% 6%, rgba(49, 95, 174, 0.08), transparent 24rem),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

button,
input,
select,
textarea,
summary {
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(49, 95, 174, 0.23);
  outline-offset: 2px;
}

button:active:not(:disabled),
summary:active {
  transform: translateY(1px);
}

.eyebrow {
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(400px, 0.75fr);
  place-items: stretch;
  padding: 0;
  overflow: hidden;
  background: #eef3fb;
}

.login-brand-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(75, 126, 203, 0.26), transparent 19rem),
    linear-gradient(145deg, #101e48 0%, #182f6d 58%, #244b91 100%);
  color: #fff;
}

.login-brand-stage::before,
.login-brand-stage::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.login-brand-stage::before {
  width: 700px;
  height: 700px;
  left: -310px;
  bottom: -330px;
}

.login-brand-stage::after {
  width: 420px;
  height: 420px;
  right: -210px;
  top: -190px;
}

.login-grid-glow {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, transparent, #000 28%, #000 72%, transparent);
}

.login-orbit {
  position: absolute;
  width: 560px;
  height: 210px;
  border: 1px solid rgba(242, 201, 76, 0.25);
  border-radius: 50%;
}

.orbit-one {
  transform: rotate(28deg);
}

.orbit-two {
  transform: rotate(-28deg);
  border-color: rgba(98, 159, 235, 0.24);
}

.login-brand-content {
  position: relative;
  z-index: 1;
  width: min(680px, 82%);
  display: grid;
  justify-items: center;
  text-align: center;
}

.login-logo {
  width: min(570px, 90%);
  height: 250px;
  margin: 0 0 26px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.97);
  object-fit: cover;
  object-position: center;
  box-shadow: 0 24px 55px rgba(1, 7, 26, 0.25);
}

.login-brand-copy {
  display: grid;
  gap: 10px;
  max-width: 560px;
}

.login-brand-copy .eyebrow {
  color: #f6d75f;
}

.login-brand-copy h1 {
  font-size: clamp(30px, 3vw, 46px);
  letter-spacing: -0.04em;
}

.login-brand-copy p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 16px;
}

.login-feature-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.login-feature-list span {
  padding: 7px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.login-panel {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: grid;
  align-content: center;
  padding: clamp(36px, 7vw, 88px);
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: -24px 0 60px rgba(9, 25, 61, 0.12);
}

.login-panel-heading {
  display: grid;
  gap: 8px;
}

.login-panel-heading h2 {
  margin-top: 3px;
  font-size: 31px;
  letter-spacing: -0.04em;
}

.login-panel-heading p {
  color: var(--muted);
}

.mobile-brand {
  display: none;
}

.login-form {
  margin-top: 32px;
  gap: 18px;
}

label > span {
  color: #4d5970;
  font-weight: 650;
}

input,
select,
textarea {
  min-height: 43px;
  border-color: #d8e0ec;
  border-radius: 9px;
  padding: 10px 13px;
}

textarea {
  min-height: 96px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b8c5d9;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(49, 95, 174, 0.12);
}

.primary,
.ghost,
.danger,
.icon-btn,
.sidebar-logout,
.text-button {
  min-height: 40px;
  border-radius: 9px;
  padding: 9px 15px;
  font-weight: 700;
}

.primary {
  background: linear-gradient(135deg, #386bbd, #29539c);
  color: #fff;
  box-shadow: 0 8px 18px rgba(49, 95, 174, 0.22);
}

.primary:hover {
  background: linear-gradient(135deg, #315fae, #203f80);
  box-shadow: 0 10px 22px rgba(49, 95, 174, 0.29);
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: #33405a;
}

.ghost:hover {
  border-color: #c5d0df;
  background: var(--panel-soft);
}

.text-button {
  background: transparent;
  color: var(--brand);
}

.text-button:hover {
  background: var(--brand-soft);
}

.danger {
  background: #fff0f2;
  color: var(--danger);
}

.danger:hover {
  background: #ffe3e8;
}

.login-submit {
  min-height: 48px;
  margin-top: 3px;
}

.hint {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.system-version {
  margin-top: -8px;
  color: #8490a5;
  font-size: 12px;
  text-align: center;
}

.site-filing {
  color: #7b8798;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.site-filing a {
  color: inherit;
  text-decoration: none;
}

.site-filing a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.login-filing {
  position: absolute;
  right: clamp(36px, 7vw, 88px);
  bottom: 24px;
  left: clamp(36px, 7vw, 88px);
}

.app-filing {
  grid-column: 2;
  width: 100%;
  max-width: 1540px;
  margin: -18px auto 0;
  padding: 0 34px 28px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  align-items: start;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  grid-column: 1;
  grid-row: 1 / span 20;
  width: 248px;
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  padding: 24px 18px 18px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  background:
    radial-gradient(circle at 15% 12%, rgba(78, 132, 215, 0.3), transparent 13rem),
    linear-gradient(180deg, #172a62, #101c42);
  color: #fff;
  backdrop-filter: none;
}

.app-brand {
  min-height: 60px;
  gap: 10px;
}

.brand-logo-crop {
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.brand-logo-crop img {
  position: absolute;
  top: -32px;
  left: 50%;
  width: 190px;
  max-width: none;
  transform: translateX(-50%);
}

.brand-copy {
  min-width: 0;
}

.brand-copy .eyebrow {
  color: #f6d75f;
  font-size: 9px;
}

.brand-block.compact h1 {
  margin-top: 3px;
  color: #fff;
  font-size: 20px;
}

.tabs {
  display: grid;
  gap: 6px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.tabs button {
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 13px;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  text-align: left;
}

.tabs button::before {
  width: 24px;
  font-size: 18px;
  text-align: center;
  opacity: 0.9;
}

.tabs button[data-icon="inventory"]::before { content: "▦"; }
.tabs button[data-icon="borrow"]::before { content: "⇄"; }
.tabs button[data-icon="purchase"]::before { content: "◇"; }
.tabs button[data-icon="device"]::before { content: "⬡"; }
.tabs button[data-icon="user"]::before { content: "◎"; }

.tabs button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.tabs button.active {
  border-color: rgba(255, 255, 255, 0.09);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
  color: #fff;
  box-shadow: inset 3px 0 #f2c94c, 0 8px 20px rgba(4, 11, 34, 0.15);
}

.user-panel {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.07);
}

.user-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #172a62;
  font-weight: 900;
}

.user-panel b {
  display: block;
  font-size: 12px;
}

.user-panel p {
  margin-top: 2px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
}

.account-actions {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.notice-panel,
.page-band {
  grid-column: 2;
  width: 100%;
}

.notice-panel {
  max-width: 1540px;
}

.page-band {
  max-width: 1540px;
  padding: 34px 34px 46px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 24px;
}

.page-heading h2 {
  margin-top: 5px;
  font-size: 28px;
  letter-spacing: -0.035em;
}

.page-heading p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.page-primary-actions {
  flex-wrap: nowrap;
}

.toolbar {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.filter-group {
  grid-template-columns: minmax(280px, 1fr) minmax(170px, 220px) auto;
}

#searchInput {
  padding-left: 41px;
  background:
    linear-gradient(45deg, transparent 45%, #7e8aa0 45%, #7e8aa0 55%, transparent 55%) 26px 26px / 7px 7px no-repeat,
    radial-gradient(circle, transparent 46%, #7e8aa0 48%, #7e8aa0 58%, transparent 60%) 14px 12px / 17px 17px no-repeat,
    #fff;
}

.checkline {
  min-height: 42px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--muted);
}

.checkline:hover {
  background: var(--panel-soft);
}

.stats-row {
  gap: 14px;
  margin-bottom: 16px;
}

.stats-row div {
  position: relative;
  min-height: 102px;
  align-content: center;
  padding: 18px 20px 18px 24px;
  border-color: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.stats-row div::before {
  content: "";
  position: absolute;
  inset: 18px auto 18px 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand);
}

.stats-row div:nth-child(2)::before { background: var(--good); }
.stats-row div:nth-child(3)::before { background: var(--accent); }
.stats-row div:nth-child(4)::before { background: var(--danger); }

.stats-row b {
  color: #1c2b49;
  font-size: 29px;
}

.stats-row span {
  font-size: 13px;
}

.table-wrap {
  border-color: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

table {
  min-width: 920px;
}

th,
td {
  padding: 13px 14px;
}

th {
  background: #f5f7fb;
  color: #59657b;
  font-size: 12px;
  letter-spacing: 0.02em;
}

td {
  color: #354158;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tr:hover td {
  background: #f8faff;
}

.part-name {
  color: #1e2c48;
  font-size: 14px;
}

.subtle a,
.detail-item a {
  color: var(--brand);
}

.qty {
  min-width: 38px;
  border-radius: 8px;
  background: #e7f6f1;
}

.level {
  min-width: 72px;
  border-radius: 999px;
  padding: 5px 10px;
}

.level.low {
  background: #e9f1ff;
  color: #315fae;
}

.level.common {
  background: #e7f6f1;
  color: #167458;
}

.level.key {
  background: var(--accent-soft);
  color: #8a6107;
}

.row-actions {
  align-items: center;
  flex-wrap: nowrap;
}

.row-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
  color: #38465f;
  white-space: nowrap;
}

.row-actions button:hover {
  border-color: #c8d3e3;
  background: #f5f8fd;
}

.row-actions .primary {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
  box-shadow: none;
}

.row-actions .danger {
  border-color: transparent;
  background: #fff0f2;
  color: var(--danger);
}

.action-menu > summary::after,
.action-menu[open] > summary::after {
  content: "⌄";
}

.utility-menu > summary {
  min-height: 40px;
  display: flex;
  align-items: center;
}

.action-menu-list {
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(22, 38, 75, 0.17);
}

.row-menu {
  align-self: center;
}

.row-menu > summary {
  width: 36px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #657088;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.row-menu > summary::after {
  display: none;
}

.row-menu .action-menu-list {
  min-width: 158px;
}

.row-menu .action-menu-list .danger {
  background: transparent;
  color: var(--danger);
}

.row-menu .action-menu-list .danger:hover {
  background: #fff0f2;
}

dialog {
  border-radius: 14px;
  box-shadow: 0 28px 90px rgba(15, 29, 62, 0.28);
}

dialog::backdrop {
  background: rgba(12, 22, 48, 0.58);
  backdrop-filter: blur(3px);
}

.dialog-panel {
  gap: 20px;
  padding: 24px;
}

.dialog-panel > header {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.dialog-panel > footer {
  position: sticky;
  bottom: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.icon-btn {
  border-radius: 9px;
  background: var(--panel-soft);
}

.detail-item,
.device-card,
.import-record {
  border-radius: 10px;
}

.device-card {
  box-shadow: var(--shadow-soft);
}

.toast {
  right: 24px;
  bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: #142551;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 216px minmax(0, 1fr);
  }

  .topbar {
    width: 216px;
  }

  .brand-copy h1 {
    font-size: 18px;
  }

  .page-band {
    padding-inline: 24px;
  }

  .filter-group {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px);
  }

  .checkline {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  body {
    padding-bottom: 74px;
  }

  body:has(#loginView:not(.hidden)) {
    padding-bottom: 0;
  }

  .login-shell {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .login-brand-stage {
    min-height: 300px;
  }

  .login-brand-content {
    width: min(620px, 88%);
  }

  .login-logo {
    width: min(430px, 80%);
    height: 190px;
    margin: 0 0 18px;
  }

  .login-brand-copy h1 {
    font-size: 30px;
  }

  .login-feature-list {
    margin-top: 18px;
  }

  .login-panel {
    min-height: auto;
    padding: 42px max(24px, 10vw) 54px;
    box-shadow: 0 -18px 48px rgba(13, 31, 70, 0.12);
  }

  .app-shell {
    display: block;
  }

  .topbar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    min-height: 68px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    color: var(--ink);
    backdrop-filter: none;
  }

  .app-brand {
    flex: 1 1 auto;
    min-height: 48px;
    min-width: 0;
  }

  .brand-logo-crop {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    box-shadow: var(--shadow-soft);
  }

  .brand-logo-crop img {
    top: -29px;
    width: 171px;
  }

  .brand-copy .eyebrow {
    display: none;
  }

  .brand-block.compact h1 {
    color: var(--ink);
    font-size: 16px;
    white-space: nowrap;
  }

  .user-panel {
    display: none;
  }

  .sidebar-logout {
    min-height: 38px;
    align-self: center;
    border-color: var(--line);
    color: var(--muted);
  }

  .account-actions {
    flex: 0 0 180px;
    width: min(180px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    justify-content: flex-end;
  }

  .account-actions .sidebar-logout {
    min-width: 0;
    padding-inline: 10px;
  }

  #accountEmailBtn {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-logout:hover {
    background: var(--panel-soft);
    color: var(--ink);
  }

  .tabs {
    position: fixed;
    z-index: 20;
    right: 10px;
    bottom: 9px;
    left: 10px;
    grid-column: auto;
    display: flex;
    justify-content: space-around;
    gap: 3px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 17px;
    background: rgba(19, 36, 78, 0.96);
    box-shadow: 0 16px 38px rgba(11, 22, 52, 0.28);
    backdrop-filter: blur(15px);
  }

  .tabs button {
    min-width: 56px;
    min-height: 49px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    text-align: center;
  }

  .tabs button::before {
    width: auto;
    font-size: 17px;
  }

  .tabs button.active {
    box-shadow: inset 0 -3px #f2c94c;
  }

  .notice-panel,
  .page-band {
    width: 100%;
  }

  .page-band {
    padding: 24px 18px 30px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-row div {
    min-height: 86px;
  }
}

@media (max-width: 680px) {
  .login-brand-stage {
    min-height: 245px;
  }

  .login-logo {
    width: 350px;
    max-width: 100%;
    height: 150px;
  }

  .login-brand-copy h1 {
    font-size: 23px;
  }

  .login-brand-copy p,
  .login-feature-list {
    display: none;
  }

  .login-panel {
    padding: 34px 22px 44px;
  }

  .page-heading {
    display: grid;
    gap: 18px;
    margin-bottom: 20px;
  }

  .page-heading h2 {
    font-size: 24px;
  }

  .page-primary-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .page-primary-actions > * {
    width: 100%;
  }

  .utility-menu > summary {
    justify-content: center;
  }

  .toolbar {
    padding: 12px;
  }

  .filter-group {
    grid-template-columns: 1fr;
  }

  .checkline {
    grid-column: auto;
  }

  .stats-row {
    gap: 9px;
  }

  .stats-row div {
    min-height: 78px;
    padding: 14px 14px 14px 18px;
  }

  .stats-row b {
    font-size: 24px;
  }

  #inventoryTab .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #inventoryTab table {
    min-width: 0;
  }

  #inventoryTab thead {
    display: none;
  }

  #inventoryTab tbody {
    display: grid;
    gap: 11px;
  }

  #inventoryTab tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-soft);
  }

  #inventoryTab tbody td {
    display: block;
    padding: 0;
    border: 0;
    background: transparent !important;
  }

  #inventoryTab tbody td:nth-child(1) {
    grid-column: 1;
    grid-row: 2;
    color: var(--muted);
    font-size: 12px;
  }

  #inventoryTab tbody td:nth-child(2) {
    grid-column: 1;
    grid-row: 1;
  }

  #inventoryTab tbody td:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
    color: var(--muted);
    font-size: 13px;
  }

  #inventoryTab tbody td:nth-child(3)::before {
    content: "型号 ";
    color: #9aa4b6;
  }

  #inventoryTab tbody td:nth-child(4),
  #inventoryTab tbody td:nth-child(5),
  #inventoryTab tbody td:nth-child(7),
  #inventoryTab tbody td:nth-child(9) {
    display: none;
  }

  #inventoryTab tbody td:nth-child(6) {
    grid-column: 2;
    grid-row: 1;
  }

  #inventoryTab tbody td:nth-child(8) {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: end;
  }

  #inventoryTab tbody td:nth-child(10) {
    grid-column: 1 / -1;
    grid-row: 4;
    margin-top: 5px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  #inventoryTab tbody .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
  }

  #inventoryTab tbody .row-actions > button {
    width: 100%;
  }

  .row-menu .action-menu-list {
    right: 0;
    left: auto;
  }

  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .dialog-panel,
  .dialog-panel.narrow,
  .dialog-panel.import-panel {
    width: 100%;
    padding: 18px;
  }

  .dialog-panel footer {
    flex-wrap: wrap;
  }
}
