:root {
  --bg: #edf1ee;
  --bg-grid: rgba(15, 23, 42, 0.055);
  --panel: #fbfcf9;
  --panel-strong: #ffffff;
  --ink: #121814;
  --muted: #657068;
  --subtle: #879288;
  --line: #d6ded5;
  --line-strong: #b7c4ba;
  --accent: #087a6f;
  --accent-strong: #075d55;
  --accent-soft: #d9f1ec;
  --warning: #b7791f;
  --warning-soft: #fff3d6;
  --danger: #c83232;
  --danger-soft: #ffe1df;
  --info: #2b6e8f;
  --info-soft: #dceff5;
  --sidebar: #111612;
  --sidebar-2: #1b241d;
  --shadow: 0 22px 70px rgba(17, 24, 39, 0.12);
  --soft-shadow: 0 10px 28px rgba(17, 24, 39, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    linear-gradient(0deg, var(--bg-grid) 1px, transparent 1px),
    linear-gradient(135deg, #f7f9f4 0%, var(--bg) 48%, #e7eee8 100%);
  background-size: 32px 32px, 32px 32px, auto;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fffef9;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(8, 122, 111, 0.14);
}

label {
  display: grid;
  gap: 7px;
  color: #303b34;
  font-size: 13px;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

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

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 0.92fr;
  gap: 0;
  align-items: stretch;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-brand {
  padding: 44px 42px;
  display: grid;
  align-content: center;
  gap: 24px;
  background:
    linear-gradient(135deg, rgba(8, 122, 111, 0.13), rgba(255, 255, 255, 0) 48%),
    linear-gradient(90deg, rgba(17, 22, 18, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(17, 22, 18, 0.045) 1px, transparent 1px),
    #f6faf4;
  background-size: auto, 24px 24px, 24px 24px, auto;
  border-right: 1px solid var(--line);
}

.login-title-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.lab-icon {
  position: relative;
  width: 82px;
  height: 82px;
  border: 1px solid rgba(8, 122, 111, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(217, 241, 236, 0.52)),
    #eff8f3;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 16px 34px rgba(8, 122, 111, 0.14);
}

.lab-icon::before {
  content: "";
  position: absolute;
  left: 29px;
  top: 16px;
  width: 24px;
  height: 42px;
  border: 4px solid #075d55;
  border-top: 0;
  border-radius: 0 0 15px 15px;
}

.lab-icon-neck {
  position: absolute;
  left: 33px;
  top: 11px;
  width: 16px;
  height: 12px;
  border: 4px solid #075d55;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}

.lab-icon-liquid {
  position: absolute;
  left: 35px;
  top: 39px;
  width: 12px;
  height: 13px;
  border-radius: 0 0 9px 9px;
  background: var(--accent);
  box-shadow: 8px 0 0 var(--accent);
}

.lab-icon-pill {
  position: absolute;
  right: 12px;
  bottom: 13px;
  width: 28px;
  height: 13px;
  border-radius: 999px;
  background: linear-gradient(90deg, #d6b15c 0 50%, #fffef9 50% 100%);
  border: 1px solid rgba(183, 121, 31, 0.32);
  transform: rotate(-18deg);
}

.login-panel h1,
.section-head h2 {
  margin: 0;
  font-weight: 950;
  line-height: 1.12;
}

.login-panel h1 {
  max-width: 9em;
  font-size: 38px;
}

.login-panel .muted {
  max-width: 32em;
  line-height: 1.8;
  font-size: 15px;
}

.login-panel form {
  padding: 44px 42px;
  align-content: center;
  background: rgba(255, 255, 255, 0.82);
}

.stack {
  display: grid;
  gap: 16px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  color: #edf6ee;
  background:
    linear-gradient(180deg, rgba(8, 122, 111, 0.2), transparent 38%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    var(--sidebar);
  background-size: auto, 22px 22px, auto;
  border-right: 1px solid #243128;
}

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

.brand strong {
  display: block;
  font-weight: 950;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: #aebbae;
  font-size: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #12a092, #d6b15c);
  color: #06110d;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
}

nav {
  display: grid;
  gap: 7px;
}

.nav,
.ghost {
  width: 100%;
  min-height: 42px;
  border-radius: 7px;
  padding: 11px 12px;
  color: #cbd8cd;
  background: transparent;
  text-align: left;
  font-weight: 850;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.nav:hover,
.ghost:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
}

.nav.active {
  color: #0d1711;
  background: #e5f4e5;
  box-shadow: inset 4px 0 0 #d6b15c;
}

.ghost {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

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

.tab {
  display: none;
}

.tab.active {
  display: block;
  animation: surface-in 0.18s ease-out;
}

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

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

.section-head h2 {
  font-size: 28px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.toolbar {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  width: min(330px, 32vw);
}

.toolbar select {
  width: 148px;
}

.primary,
.secondary,
.danger,
.text-button {
  min-height: 40px;
  border-radius: 7px;
  padding: 10px 14px;
  font-weight: 900;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.primary {
  background: linear-gradient(180deg, #0b9184, var(--accent));
  color: #fff;
  box-shadow: 0 12px 24px rgba(8, 122, 111, 0.22);
}

.primary:hover {
  background: linear-gradient(180deg, #0a8176, var(--accent-strong));
  transform: translateY(-1px);
}

.secondary {
  border: 1px solid #bcd4ce;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.secondary:hover {
  background: #cdeae4;
  transform: translateY(-1px);
}

.danger {
  border: 1px solid #f2aba4;
  background: var(--danger-soft);
  color: var(--danger);
}

.danger:hover {
  background: #ffd1cd;
}

.text-button {
  min-height: auto;
  padding-inline: 0;
  background: transparent;
  color: var(--accent-strong);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat,
.panel,
.table-wrap,
.warning-card,
.config-card {
  background: rgba(251, 252, 249, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
}

.stat {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  padding: 16px 16px 14px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--accent);
}

.stat::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(8, 122, 111, 0.16);
  border-radius: 8px;
  transform: rotate(8deg);
}

.stat.tone-info::before {
  background: var(--info);
}

.stat.tone-warn::before {
  background: var(--warning);
}

.stat.tone-danger::before {
  background: var(--danger);
}

.stat span,
.stat small {
  display: block;
  color: var(--muted);
  font-size: 15px;
  font-weight: 950;
}

.stat strong {
  display: block;
  margin-top: 12px;
  font-size: 40px;
  font-weight: 950;
  line-height: 1;
}

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

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

.user-admin-grid {
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
}

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

.panel {
  min-width: 0;
  padding: 18px;
}

.panel h3,
.panel h4 {
  margin: 0 0 12px;
}

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

.mini-list,
.warning-list,
.config-list {
  display: grid;
  gap: 10px;
}

.mini-item,
.warning-card,
.config-card {
  padding: 12px;
}

.mini-item,
.config-card {
  background:
    linear-gradient(90deg, rgba(8, 122, 111, 0.055), transparent 38%),
    #fffefa;
}

.warning-card {
  border-left: 5px solid var(--warning);
}

.config-card:hover,
.warning-card:hover,
.mini-item:hover {
  border-color: var(--line-strong);
}

.table-wrap {
  overflow: auto;
  background: var(--panel-strong);
}

.compact-table table {
  min-width: 680px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap table {
  min-width: 900px;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f8f2;
  color: #4b594f;
  font-size: 15px;
  font-weight: 950;
}

th,
td,
.table-wrap th,
.table-wrap td,
.mini-table th,
.mini-table td {
  text-align: center;
}

.table-wrap td {
  font-size: 15px;
  font-weight: 650;
}

.table-wrap td strong {
  font-size: 16px;
  font-weight: 950;
}

.table-wrap td small {
  font-size: 13px;
  font-weight: 800;
}

tbody tr {
  background: #fffefa;
}

tbody tr:hover {
  background: #f5fbf6;
}

.empty-cell {
  padding: 34px !important;
  text-align: center;
  color: var(--muted);
}

.mini-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.mini-table th,
.mini-table td {
  padding: 10px 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
  text-align: center;
}

.mini-table th:first-child,
.mini-table td:first-child {
  padding-left: 4px;
}

.mini-table th {
  position: static;
  font-size: 15px;
  font-weight: 950;
  text-align: center;
}

.mini-table td {
  font-size: 15px;
  font-weight: 700;
}

.mini-table td strong {
  font-size: 16px;
  font-weight: 950;
}

.mini-table td small {
  font-size: 13px;
  font-weight: 800;
}

.recent-table th:nth-child(1),
.recent-table td:nth-child(1) {
  width: 22%;
}

.recent-table th:nth-child(2),
.recent-table td:nth-child(2) {
  width: 16%;
}

.recent-table th:nth-child(3),
.recent-table td:nth-child(3) {
  width: 18%;
}

.recent-table th:nth-child(4),
.recent-table td:nth-child(4) {
  width: 44%;
}

.warning-preview-table th:nth-child(1),
.warning-preview-table td:nth-child(1) {
  width: 18%;
}

.warning-preview-table th:nth-child(2),
.warning-preview-table td:nth-child(2) {
  width: 28%;
}

.warning-preview-table th:nth-child(3),
.warning-preview-table td:nth-child(3) {
  width: 54%;
}

.dashboard-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
  text-align: center;
}

.dashboard-pager > div {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.dashboard-pager .secondary {
  min-height: 34px;
  padding: 7px 12px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.tag,
.category-chip,
.hazard-chip,
.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.tag {
  background: #edf1ee;
  color: #3f4b43;
}

.category-chip {
  --chip-color: #657068;
  border: 1px solid color-mix(in srgb, var(--chip-color) 48%, white);
  background: color-mix(in srgb, var(--chip-color) 14%, white);
  color: color-mix(in srgb, var(--chip-color) 72%, #101713);
}

.hazard-chip {
  --hazard-color: #ef4444;
  border: 1px solid color-mix(in srgb, var(--hazard-color) 68%, #ffffff);
  background: color-mix(in srgb, var(--hazard-color) 20%, #ffffff);
  color: color-mix(in srgb, var(--hazard-color) 82%, #101713);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hazard-color) 14%, transparent);
}

.chip-picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  align-items: center;
}

.hazard-pick {
  cursor: pointer;
}

.hazard-pick.active {
  background: var(--hazard-color);
  border-color: var(--hazard-color);
  color: #fff;
}

.badge {
  background: #edf1ee;
  color: #3f4b43;
}

.level-low,
.status-normal,
.status-closed {
  background: #dff4df;
  color: #166534;
}

.role-admin {
  background: #fee2e2;
  color: #991b1b;
}

.role-user {
  background: #dbeafe;
  color: #1d4ed8;
}

.level-medium,
.status-processing,
.status-low {
  background: var(--warning-soft);
  color: #8a5410;
}

.level-high,
.level-critical,
.status-expired,
.status-open,
.status-deleted {
  background: var(--danger-soft);
  color: #991b1b;
}

.stream-output {
  min-height: 260px;
  max-height: 440px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid #1d342d;
  border-radius: var(--radius);
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(165, 214, 189, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(165, 214, 189, 0.07) 1px, transparent 1px),
    #111612;
  background-size: 18px 18px, 18px 18px, auto;
  color: #d9f4df;
  line-height: 1.65;
}

.upload-box {
  position: relative;
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.drop-zone {
  min-height: 270px;
  place-items: center;
  border: 1.5px dashed #90aaa1;
  border-radius: var(--radius);
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(8, 122, 111, 0.08), transparent 40%),
    #f9fbf5;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: #e8f5ef;
  box-shadow: inset 0 0 0 3px rgba(8, 122, 111, 0.12);
}

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

.drop-content {
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
}

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

.preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
}

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

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

.compact-form button {
  align-self: end;
}

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

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

.summary-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf4;
}

.summary-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.batch-editor,
.batch-list {
  margin-top: 16px;
}

dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(90vh, 900px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(18, 24, 20, 0.54);
}

.dialog-form {
  position: relative;
  padding: 22px;
}

.dialog-form h3 {
  margin: 0 48px 18px 0;
  font-size: 22px;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf1ee;
  color: #303b34;
  font-size: 23px;
  line-height: 1;
}

.dialog-close:hover {
  background: #dde7df;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: 380px;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: #101713;
  color: #f8fff8;
  box-shadow: var(--shadow);
  font-weight: 850;
}

.toast.error {
  background: var(--danger);
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 850;
}

@media (max-width: 1180px) {
  .stats-grid,
  .dashboard-grid,
  .base-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head {
    display: grid;
  }

  .toolbar {
    justify-content: flex-start;
  }
}

@media (max-width: 980px) {
  .login-panel,
  .app-shell,
  .split,
  .dashboard-grid,
  .stats-grid,
  .base-grid {
    grid-template-columns: 1fr;
  }

  .login-brand {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .main {
    padding: 18px;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar input,
  .toolbar select {
    width: 100%;
  }

  .form-grid,
  .compact-form,
  .detail-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .login-shell {
    padding: 12px;
  }

  .login-brand,
  .login-panel form {
    padding: 24px;
  }

  .login-title-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 14px;
  }

  .lab-icon {
    width: 64px;
    height: 64px;
  }

  .lab-icon::before {
    left: 22px;
    top: 13px;
    width: 19px;
    height: 32px;
    border-width: 3px;
  }

  .lab-icon-neck {
    left: 25px;
    top: 9px;
    width: 13px;
    height: 10px;
    border-width: 3px;
  }

  .lab-icon-liquid {
    left: 27px;
    top: 31px;
    width: 9px;
    height: 10px;
    box-shadow: 6px 0 0 var(--accent);
  }

  .lab-icon-pill {
    right: 9px;
    bottom: 10px;
    width: 22px;
    height: 10px;
  }

  .login-panel h1 {
    font-size: 30px;
  }

  .main {
    padding: 14px;
  }

  .section-head h2 {
    font-size: 24px;
  }
}
