:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-2: #eef3f2;
  --line: #d9e1df;
  --line-strong: #b9c6c3;
  --text: #17211f;
  --muted: #61706d;
  --soft: #f8faf9;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --brand-soft: #d8eeeb;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #c2410c;
  --purple: #7c3aed;
  --shadow: 0 18px 38px rgba(31, 41, 55, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-width: 320px;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.top-actions,
.modal-actions,
.section-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: calc(100vh - 68px);
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 14px 8px;
}

.stat-cell {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  min-width: 0;
}

.stat-cell strong {
  display: block;
  font-size: 20px;
}

.stat-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.sidebar-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  padding: 8px 14px;
}

.search-box {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--soft);
}

.search-box span {
  color: var(--muted);
  font-size: 18px;
}

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

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 12px;
}

select,
input,
textarea {
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: white;
  color: var(--text);
}

select,
input {
  height: 38px;
  padding: 0 10px;
}

textarea {
  padding: 10px;
  resize: vertical;
  min-height: 76px;
}

.equipment-list {
  overflow: auto;
  padding: 0 8px 16px;
}

.equipment-row {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 11px 10px;
  text-align: left;
  display: grid;
  gap: 7px;
}

.equipment-row:hover {
  background: var(--soft);
}

.equipment-row.active {
  background: var(--brand-soft);
  border-color: #a6d7d2;
}

.row-main {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.row-title {
  min-width: 0;
}

.row-title strong,
.detail-title h2,
.entry-title {
  overflow-wrap: anywhere;
}

.row-title strong {
  display: block;
  font-size: 14px;
}

.row-title span,
.row-meta {
  color: var(--muted);
  font-size: 12px;
}

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

.detail-pane {
  min-width: 0;
  overflow: auto;
  padding: 22px 26px 40px;
}

.empty-state {
  height: calc(100vh - 130px);
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--text);
  margin: 0 0 8px;
}

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

.detail-title h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.detail-title p {
  margin: 7px 0 0;
  color: var(--muted);
}

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

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.info-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 11px 12px;
  min-width: 0;
}

.info-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.info-cell strong {
  display: block;
  overflow-wrap: anywhere;
}

.content-band {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
}

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

.band-head h3 {
  margin: 0;
  font-size: 15px;
}

.band-body {
  padding: 14px;
}

.notes {
  white-space: pre-wrap;
  line-height: 1.7;
  margin: 0;
}

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

.field-table th,
.field-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

.field-table th {
  color: var(--muted);
  font-weight: 600;
  width: 180px;
}

.field-table tr:last-child th,
.field-table tr:last-child td {
  border-bottom: 0;
}

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

.tab-button {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  border-radius: 999px;
  min-height: 32px;
  padding: 0 12px;
}

.tab-button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

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

.entry-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

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

.entry-title {
  font-weight: 750;
  font-size: 15px;
}

.entry-content {
  margin: 9px 0 0;
  white-space: pre-wrap;
  color: #273532;
  line-height: 1.65;
}

.entry-meta,
.tag-row,
.attachment-list,
.kv-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.entry-meta {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.tag-row {
  margin-top: 9px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #edf2f7;
  color: #394844;
  padding: 2px 9px;
  font-size: 12px;
}

.status-pill,
.type-pill,
.severity-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-running,
.status-resolved {
  background: #dcfce7;
  color: #166534;
}

.status-standby,
.status-tracking {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-repair,
.status-open {
  background: #ffedd5;
  color: #9a3412;
}

.status-retired,
.status-archived {
  background: #e5e7eb;
  color: #374151;
}

.severity-none {
  background: #eef2f7;
  color: #4b5563;
}

.severity-low {
  background: #e0f2fe;
  color: #0369a1;
}

.severity-medium {
  background: #fef3c7;
  color: #92400e;
}

.severity-high,
.severity-critical {
  background: #fee2e2;
  color: #b91c1c;
}

.type-pill {
  background: #ecfdf5;
  color: var(--brand-strong);
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  padding: 4px 8px;
  background: var(--soft);
}

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

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--text);
  display: inline-grid;
  place-items: center;
  font-size: 19px;
  line-height: 1;
}

.icon-button.primary,
.solid-button {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.icon-button.ghost {
  border-color: transparent;
  background: transparent;
}

.solid-button,
.text-button,
.danger-text,
.file-button span {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.solid-button {
  font-weight: 700;
}

.text-button {
  background: white;
  color: var(--text);
}

.danger-text {
  background: white;
  color: #b91c1c;
  border-color: #fecaca;
}

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

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

.file-button span {
  background: white;
}

.modal {
  width: min(980px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.modal-body {
  padding: 18px;
}

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

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

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

.form-grid label,
.kv-row {
  display: grid;
  gap: 6px;
}

.form-grid label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.form-section {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 14px;
}

.section-line {
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-line h3 {
  margin: 0;
  font-size: 14px;
}

.kv-list {
  display: grid;
  grid-template-columns: 1fr;
}

.kv-row {
  grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) 38px;
  align-items: center;
  width: 100%;
}

.kv-row input {
  width: 100%;
}

.modal-actions {
  margin-top: 18px;
  justify-content: flex-end;
}

.grow {
  flex: 1;
}

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

.mini-empty {
  color: var(--muted);
  padding: 8px 0;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 48vh;
  }

  .detail-pane {
    padding: 18px 16px 34px;
  }

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

@media (max-width: 720px) {
  .topbar {
    padding: 0 12px;
  }

  .brand p {
    display: none;
  }

  .stats-strip,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .filters,
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .detail-head,
  .entry-top,
  .band-head {
    display: grid;
  }

  .detail-actions {
    justify-content: stretch;
  }

  .detail-actions button {
    flex: 1;
  }

  .kv-row {
    grid-template-columns: 1fr 1fr 38px;
  }
}
