:root {
  --bg: #f4f7fa;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1890ff;
  --brand-dark: #096dd9;
  --accent: #1abc9c;
  --warn: #d9363e;
  --side: #2c3e50;
  --side-soft: #34495e;
  --focus: #1abc9c;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 14px;
  line-height: 1.5715;
  letter-spacing: 0;
}

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

button {
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background-color: #f0f2f5;
  background-image: url("https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg");
  background-repeat: no-repeat;
  background-position: center 110px;
  background-size: 100%;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid #f0f0f0;
  border-radius: 2px;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.login-title {
  margin: 0;
  min-height: 58px;
  padding: 16px 24px;
  border-bottom: 1px solid #f0f0f0;
  color: rgba(0, 0, 0, 0.85);
  font-size: 16px;
  font-weight: 500;
  line-height: 25.144px;
}

.login-body {
  padding: 24px;
}

.login-lang {
  display: flex;
  margin-bottom: 18px;
}

.login-lang .language-control {
  width: 100%;
  justify-content: space-between;
  color: #475569;
}

.login-lang .language-select {
  min-width: 140px;
  min-height: 33px;
  height: 33px;
  border-color: #d9d9d9;
  padding: 6px 8px;
  color: #475569;
}

.login-field {
  margin-bottom: 24px;
}

.login-field > label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.input-prefix {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  margin-right: 5px;
  color: rgba(0, 0, 0, 0.45);
  position: relative;
}

.user-prefix::before,
.user-prefix::after {
  content: "";
  position: absolute;
  left: 50%;
  border: 1.6px solid currentColor;
  transform: translateX(-50%);
}

.user-prefix::before {
  top: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.user-prefix::after {
  bottom: 0;
  width: 10px;
  height: 6px;
  border-radius: 8px 8px 2px 2px;
}

.lock-prefix::before {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 0;
  width: 10px;
  height: 8px;
  border: 1.6px solid currentColor;
  border-radius: 2px;
}

.lock-prefix::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  width: 6px;
  height: 7px;
  border: 1.6px solid currentColor;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.login-options {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  color: #475569;
  font-size: 14px;
}

.login-options a {
  color: var(--brand);
  text-decoration: none;
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.remember-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.login-submit {
  min-height: 40px;
  font-size: 16px;
}

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

.sidebar {
  background: var(--side);
  color: #ecf0f1;
  padding: 0;
  overflow: auto;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.15);
}

.brand {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 10px;
  text-align: center;
}

.brand-title {
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.brand-subtitle {
  color: #b8c4cf;
  font-size: 12px;
  margin-top: 8px;
}

.nav-group {
  margin: 8px 0;
}

.nav-group-title {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #aebbc8;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px 8px 20px;
  border-left: 4px solid transparent;
  border-radius: 0;
  transition: all 0.2s ease;
}

.nav-group-title:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-group-arrow {
  width: 18px;
  text-align: center;
  color: #90a4b7;
  font-size: 12px;
}

.nav-group-items {
  display: grid;
}

.nav-button {
  width: 100%;
  text-align: left;
  color: #ecf0f1;
  background: transparent;
  padding: 10px 20px 10px 24px;
  margin: 0;
  border-left: 4px solid transparent;
  border-radius: 0;
  transition: all 0.2s ease;
}

.nav-button:hover,
.nav-button.active {
  background: var(--side-soft);
  color: #fff;
}

.nav-button.active {
  color: var(--focus);
  border-left-color: var(--focus);
  font-weight: 700;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
}

.user-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.language-select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  background: #fff;
  color: var(--ink);
}

.content {
  padding: 30px;
  overflow: auto;
}

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

.section-head h2 {
  margin: 0;
  font-size: 22px;
}

.section-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.section-head > .actions {
  justify-content: flex-end;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel-title {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  background: #fff;
}

.form {
  padding: 16px;
  display: grid;
  gap: 12px;
}

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

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

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  min-height: 38px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.form-field textarea {
  min-height: 86px;
  resize: vertical;
}

.login-panel .login-form {
  display: block;
  width: 100%;
  height: 198px;
  padding: 0;
  margin: 0;
}

.login-panel .login-field {
  display: flex;
  width: 100%;
  height: 32px;
  margin: 0 0 24px;
  padding: 0;
}

.login-panel .login-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
  height: 32px;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  padding: 4px 11px;
  background: #fff;
  color: rgba(0, 0, 0, 0.85);
}

.login-panel .login-field input {
  flex: 1 1 auto;
  width: auto;
  min-height: 0;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.85);
  line-height: 22px;
  outline: 0;
}

.login-panel .login-options {
  height: 22px;
  margin: 0 0 24px;
  color: rgba(0, 0, 0, 0.85);
  line-height: 22.001px;
}

.login-panel .remember-row {
  align-items: baseline;
  height: 22px;
  color: rgba(0, 0, 0, 0.85);
  line-height: 22.001px;
}

.login-panel .remember-row input {
  width: 16px;
  height: 16px;
}

.login-panel .login-submit {
  display: inline-block;
  width: auto;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  padding: 4px 15px;
  border-radius: 2px;
  box-shadow: rgba(0, 0, 0, 0.043) 0 2px 0 0;
  line-height: 25.144px;
}

.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.check-row input {
  width: 16px;
  height: 16px;
}

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

.inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.btn {
  min-height: 34px;
  padding: 7px 15px;
  background: #fff;
  color: var(--ink);
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

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

.btn.danger {
  background: #fff;
  border-color: #ff4d4f;
  color: var(--warn);
}

.btn.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
}

.btn:disabled {
  cursor: not-allowed;
  color: #bfbfbf;
  background: #f5f5f5;
  border-color: #d9d9d9;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.search-control {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.search-control span {
  white-space: nowrap;
}

.search-control input {
  width: 100%;
  min-height: 34px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding: 6px 10px;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.sort-control select {
  min-height: 34px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding: 6px 30px 6px 10px;
  background: #fff;
  color: var(--ink);
}

.result-count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

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

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

.data-table {
  width: max(100%, var(--table-min-width));
  min-width: var(--table-min-width);
  table-layout: fixed;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  background: #fafafa;
  position: sticky;
  top: 0;
  font-weight: 600;
}

.table-column-head {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.column-sort {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 2px 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-weight: 600;
}

.column-sort:hover,
.column-sort.active {
  color: var(--brand-dark);
}

.sort-indicator {
  width: 12px;
  flex: 0 0 12px;
  color: #a0a7b1;
  font-size: 11px;
  line-height: 1;
  text-align: center;
}

.column-sort.active .sort-indicator {
  color: var(--brand);
}

.column-filter {
  position: relative;
  flex: 0 0 auto;
}

.column-filter summary {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  list-style: none;
  border-radius: 3px;
  color: #8c8c8c;
  cursor: pointer;
}

.column-filter summary::-webkit-details-marker {
  display: none;
}

.column-filter summary:hover,
.column-filter[open] summary,
.column-filter.active summary {
  background: #e6f7ff;
  color: var(--brand-dark);
}

.filter-icon {
  position: relative;
  width: 13px;
  height: 13px;
  display: block;
}

.filter-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 1px;
  width: 7px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.filter-icon::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 5px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: center;
}

.column-filter-popover {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  left: 0;
  width: 230px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
}

.column-filter-popover input {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
}

.column-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.column-filter-actions .btn {
  min-height: 30px;
  padding: 4px 11px;
}

td {
  max-width: 280px;
  word-break: break-word;
}

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

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 150px;
}

.audit-action {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 3px 8px;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #dbe2ea;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.audit-action.success {
  color: #237804;
  background: #f6ffed;
  border-color: #b7eb8f;
}

.audit-action.active {
  color: #0958d9;
  background: #e6f4ff;
  border-color: #91caff;
}

.audit-action.danger {
  color: #cf1322;
  background: #fff1f0;
  border-color: #ffccc7;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.pagination-summary {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.pagination-controls,
.page-numbers,
.page-size-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-size-control {
  margin-right: 4px;
  color: var(--muted);
  white-space: nowrap;
}

.page-size-control select {
  min-height: 34px;
  padding: 5px 28px 5px 9px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

.page-number {
  width: 34px;
  min-width: 34px;
  padding: 5px;
}

.page-number.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

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

.repair-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.repair-metric-card {
  min-height: 92px;
}

.repair-metric-card.attention {
  border-color: #ffccc7;
  background: #fff2f0;
}

.repair-table table {
  min-width: 1280px;
}

.repair-no {
  color: #0958d9;
  white-space: nowrap;
}

.status-badge,
.urgency-badge,
.overdue-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.new {
  background: #f0f5ff;
  color: #1d39c4;
}

.status-badge.active {
  background: #e6f7ff;
  color: #0958d9;
}

.status-badge.waiting {
  background: #fff7e6;
  color: #ad6800;
}

.status-badge.done {
  background: #f6ffed;
  color: #237804;
}

.status-badge.muted {
  background: #f5f5f5;
  color: #595959;
}

.urgency-badge.normal {
  background: #f6ffed;
  color: #237804;
}

.urgency-badge.urgent {
  background: #fff7e6;
  color: #ad6800;
}

.urgency-badge.critical,
.overdue-chip {
  background: #fff1f0;
  color: #cf1322;
}

.repair-row-overdue td {
  background: #fffafa;
}

.repair-due {
  display: grid;
  gap: 5px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.36);
}

.drawer {
  width: min(560px, 100%);
  height: 100%;
  overflow: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.18);
}

.repair-drawer {
  width: min(760px, 100%);
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.drawer-head h3 {
  margin: 0;
  font-size: 18px;
}

.permission-matrix {
  display: grid;
  gap: 1px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--line);
}

.permission-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) repeat(6, minmax(66px, 0.7fr));
  align-items: center;
  min-width: 590px;
  background: #fff;
}

.permission-head {
  color: var(--muted);
  background: #fafafa;
  font-size: 12px;
}

.permission-row strong,
.permission-row span,
.permission-row label {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 8px;
  text-align: center;
}

.permission-row strong {
  justify-content: start;
  text-align: left;
}

.permission-row input {
  width: 16px;
  height: 16px;
}

.advanced-permissions {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
}

.advanced-permissions summary {
  cursor: pointer;
  font-weight: 700;
}

.advanced-permissions p {
  margin: 8px 0;
  color: var(--muted);
}

.advanced-permissions textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding: 8px 10px;
}

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

.tag-list span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 4px;
  background: #f0f5ff;
  color: var(--muted);
}

.import-help {
  margin: 0;
  color: var(--muted);
}

.import-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-columns span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fafafa;
  color: var(--muted);
  font-size: 12px;
}

.repair-form {
  gap: 16px;
}

.repair-form-section {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.repair-form-section legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 700;
}

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

.repair-form-grid .span-2 {
  grid-column: 1 / -1;
}

.repair-form input[readonly] {
  background: #fafafa;
  color: var(--muted);
}

.import-result {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #b7eb8f;
  border-radius: 4px;
  background: #f6ffed;
}

.import-result p {
  margin: 0;
  color: var(--muted);
}

.import-errors {
  display: grid;
  gap: 4px;
  max-height: 170px;
  overflow: auto;
  color: var(--warn);
  font-size: 13px;
}

.preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.46);
}

.preview-modal {
  width: min(1040px, 100%);
  max-height: min(860px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr) auto;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
}

.preview-head,
.preview-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.preview-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.preview-head h3 {
  margin: 0;
  font-size: 18px;
}

.preview-head span {
  display: block;
  max-width: 760px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-body {
  min-height: 0;
  overflow: auto;
  background: #f8fafc;
}

.preview-frame {
  width: 100%;
  height: 70vh;
  min-height: 520px;
  display: block;
  border: 0;
  background: #fff;
}

.preview-image-wrap {
  min-height: 520px;
  display: grid;
  place-items: center;
  padding: 18px;
}

.preview-image-wrap img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
}

.preview-text {
  min-height: 520px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: #fff;
  color: #111827;
  font-family: Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.preview-message {
  min-height: 320px;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

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

.preview-message.error {
  margin: 0;
}

.preview-truncated {
  padding: 10px 14px;
  border-bottom: 1px solid #f5d591;
  background: #fff7e6;
  color: #ad6800;
  font-size: 13px;
}

.notice {
  border: 1px solid var(--line);
  background: #e6f7ff;
  color: #0958d9;
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.error {
  color: var(--warn);
  background: #fff3f0;
  border: 1px solid #ecc5bd;
  padding: 10px 12px;
  border-radius: 4px;
  margin: 12px 0;
}

.dashboard-page {
  width: min(100%, 1480px);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.dashboard-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 2px 22px;
  border-bottom: 1px solid var(--line);
}

.dashboard-welcome-copy {
  min-width: 0;
}

.dashboard-welcome-copy time {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-welcome-copy h2 {
  margin: 0;
  color: #172033;
  font-size: 27px;
  line-height: 1.35;
  font-weight: 700;
}

.dashboard-welcome-copy p {
  margin: 7px 0 0;
  color: #596579;
  font-size: 15px;
}

.dashboard-quick-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

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

.dashboard-kpi {
  position: relative;
  min-width: 0;
  min-height: 136px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  gap: 3px 12px;
  padding: 18px 18px 15px 22px;
  overflow: hidden;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.dashboard-kpi:hover {
  border-color: #b7d9ff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.dashboard-kpi-line {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #1677ff;
}

.dashboard-kpi.green .dashboard-kpi-line {
  background: #23a26d;
}

.dashboard-kpi.amber .dashboard-kpi-line {
  background: #d89614;
}

.dashboard-kpi.red .dashboard-kpi-line {
  background: #d9363e;
}

.dashboard-kpi-label {
  min-width: 0;
  color: #596579;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.dashboard-kpi strong {
  grid-column: 1 / -1;
  align-self: center;
  color: #172033;
  font-size: 32px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.dashboard-kpi-hint {
  min-width: 0;
  color: #8791a3;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.dashboard-kpi-link {
  color: #1677ff;
  font-size: 12px;
  white-space: nowrap;
}

.dashboard-work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 14px;
  align-items: stretch;
}

.dashboard-tool {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035);
}

.dashboard-tool-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #edf0f4;
}

.dashboard-tool-head h3 {
  margin: 0;
  color: #202a3b;
  font-size: 16px;
  line-height: 1.4;
}

.dashboard-tool-head p {
  margin: 3px 0 0;
  color: #8791a3;
  font-size: 12px;
}

.dashboard-count {
  min-width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  color: #cf1322;
  background: #fff1f0;
  border: 1px solid #ffccc7;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-attention-list,
.dashboard-activity-list {
  display: grid;
}

.dashboard-attention-row,
.dashboard-activity-row {
  min-width: 0;
  min-height: 70px;
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border-bottom: 1px solid #edf0f4;
  border-radius: 0;
}

.dashboard-attention-row {
  grid-template-columns: 4px minmax(0, 1fr) 14px;
}

.dashboard-attention-row:last-child,
.dashboard-activity-row:last-child {
  border-bottom: 0;
}

.dashboard-attention-row:hover,
.dashboard-activity-row:hover {
  background: #f8fbff;
}

.dashboard-attention-indicator {
  width: 4px;
  height: 38px;
  background: #d89614;
  border-radius: 2px;
}

.dashboard-attention-row.critical .dashboard-attention-indicator {
  background: #d9363e;
}

.dashboard-attention-content,
.dashboard-activity-content {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dashboard-attention-content strong,
.dashboard-activity-content strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #202a3b;
  font-size: 14px;
}

.dashboard-attention-content small,
.dashboard-activity-content small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #8791a3;
  font-size: 12px;
}

.dashboard-attention-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #b26a00;
  font-size: 12px;
}

.dashboard-attention-row.critical .dashboard-attention-meta {
  color: #cf1322;
}

.dashboard-attention-meta time {
  color: #8791a3;
  white-space: nowrap;
}

.dashboard-row-arrow {
  color: #a7b0bf;
  font-size: 14px;
}

.dashboard-status-list {
  display: grid;
  gap: 17px;
  padding: 18px;
}

.dashboard-status-row > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: #596579;
  font-size: 13px;
}

.dashboard-status-row strong {
  color: #202a3b;
  font-variant-numeric: tabular-nums;
}

.dashboard-status-track {
  height: 8px;
  overflow: hidden;
  background: #eef1f5;
  border-radius: 4px;
}

.dashboard-status-track span {
  display: block;
  height: 100%;
  background: #1677ff;
  border-radius: 4px;
}

.dashboard-status-row.assigned .dashboard-status-track span {
  background: #36a3eb;
}

.dashboard-status-row.in_progress .dashboard-status-track span {
  background: #23a26d;
}

.dashboard-status-row.waiting_parts .dashboard-status-track span {
  background: #d89614;
}

.dashboard-status-row.completed .dashboard-status-track span {
  background: #7b8798;
}

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

.dashboard-activity-row {
  grid-template-columns: 84px minmax(0, 1fr) 14px;
}

.dashboard-activity-row:nth-child(odd) {
  border-right: 1px solid #edf0f4;
}

.dashboard-activity-kind {
  display: inline-flex;
  width: fit-content;
  max-width: 80px;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  color: #0958d9;
  background: #e6f4ff;
  border-radius: 4px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-activity-kind.repair {
  color: #b42318;
  background: #fff1f0;
}

.dashboard-activity-kind.performance {
  color: #237804;
  background: #f6ffed;
}

.dashboard-activity-kind.work_record {
  color: #ad6800;
  background: #fffbe6;
}

.dashboard-empty-state {
  min-height: 178px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 24px;
  text-align: center;
  color: #8791a3;
}

.dashboard-empty-state strong {
  color: #596579;
  font-weight: 600;
}

.dashboard-empty-state > span:last-child {
  max-width: 420px;
  font-size: 12px;
}

.dashboard-health-mark {
  width: 28px;
  height: 28px;
  margin-bottom: 3px;
  border: 2px solid #52c41a;
  border-radius: 50%;
  background: #f6ffed;
}

.dashboard-loading {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

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

.device-health-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.device-health-item {
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-top: 3px solid #9aa4b2;
  border-radius: 4px;
  background: var(--panel);
}

.device-health-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.device-health-item strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.device-health-item.normal { border-top-color: #23a26d; }
.device-health-item.warning { border-top-color: #d89614; }
.device-health-item.critical { border-top-color: #cf1322; }

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

.device-history-head span,
.integration-hint {
  color: var(--muted);
  font-size: 13px;
}

.drawer-loading {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.integration-key-once {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid #91caff;
  border-left: 4px solid #1677ff;
  border-radius: 4px;
  background: #e6f4ff;
}

.integration-key-once p {
  margin: 5px 0 12px;
  color: #3f526d;
}

.integration-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.integration-key-row input {
  width: 100%;
  font-family: Consolas, monospace;
}

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

.integration-panel {
  margin: 0;
}

.integration-details {
  margin: 0 0 16px;
}

.integration-details div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.integration-details dt { color: var(--muted); }
.integration-details dd { margin: 0; overflow-wrap: anywhere; }

.integration-endpoints > div {
  display: grid;
  grid-template-columns: 72px minmax(280px, 1fr) minmax(220px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.integration-endpoints code { overflow-wrap: anywhere; }
.integration-endpoints small { color: var(--muted); }

.http-method {
  display: inline-flex;
  width: 60px;
  justify-content: center;
  padding: 3px 6px;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.http-method.get { background: #1677ff; }
.http-method.patch { background: #d89614; }
.http-method.post { background: #23a26d; }

.dashboard-device-health { margin-top: 14px; }

.device-health-bar {
  display: flex;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 3px;
  background: #edf0f4;
}

.device-health-bar span { min-width: 2px; }
.device-health-bar .normal, .device-health-legend .normal i { background: #23a26d; }
.device-health-bar .warning, .device-health-legend .warning i { background: #d89614; }
.device-health-bar .fault, .device-health-legend .fault i { background: #cf1322; }
.device-health-bar .offline, .device-health-legend .offline i { background: #595959; }
.device-health-bar .stale, .device-health-legend .stale i { background: #8c1d40; }
.device-health-bar .pending, .device-health-legend .pending i { background: #fa8c16; }
.device-health-bar .maintenance, .device-health-legend .maintenance i { background: #1677ff; }
.device-health-bar .unmonitored, .device-health-legend .unmonitored i { background: #b7bec8; }

.device-health-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  margin-top: 12px;
}

.device-health-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.device-health-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.device-health-legend strong { color: var(--text); }

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  min-height: 108px;
}

.metric strong {
  display: block;
  font-size: 26px;
  margin-top: 10px;
}

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

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

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

  .sidebar {
    position: static;
    max-height: 330px;
  }

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

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

  .dashboard-work-grid {
    grid-template-columns: 1fr;
  }

  .device-health-grid {
    grid-template-columns: repeat(3, minmax(118px, 1fr));
  }

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

@media (max-width: 620px) {
  .device-health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .integration-key-row,
  .integration-endpoints > div {
    grid-template-columns: 1fr;
  }
  .dashboard-welcome {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .dashboard-welcome-copy h2 {
    font-size: 23px;
  }

  .dashboard-quick-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .dashboard-quick-actions .btn {
    flex: 1 1 calc(50% - 8px);
  }

  .dashboard-kpi-grid,
  .dashboard-activity-list {
    grid-template-columns: 1fr;
  }

  .dashboard-kpi {
    min-height: 124px;
  }

  .dashboard-activity-row:nth-child(odd) {
    border-right: 0;
  }

  .dashboard-activity-row {
    grid-template-columns: 76px minmax(0, 1fr) 12px;
  }

  .dashboard-attention-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
  }

  .dashboard-attention-meta time {
    white-space: normal;
  }

  .topbar {
    height: auto;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
  }

  .content {
    padding: 14px;
  }

  .section-head {
    flex-direction: column;
  }

  .section-head > .actions {
    width: 100%;
    justify-content: flex-start;
  }

  .inline-control {
    grid-template-columns: 1fr;
  }

  .repair-form-grid {
    grid-template-columns: 1fr;
  }

  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .page-size-control {
    width: 100%;
    margin: 0 0 4px;
  }

  .preview-backdrop {
    padding: 12px;
  }

  .preview-modal {
    max-height: 94vh;
  }

  .preview-head,
  .preview-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-frame,
  .preview-image-wrap,
  .preview-text {
    min-height: 420px;
  }
}
