:root {
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: #22332f;
  background: #f5f7f6;
  font-size: 14px;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid #d9e2de;
  background: white;
  border-radius: 7px;
  padding: 9px 14px;
  color: inherit;
  transition: 0.15s;
}
.toolbar a.btn {
  display: inline-block;
  border: 1px solid #d9e2de;
  border-radius: 7px;
  padding: 9px 14px;
  text-decoration: none;
  color: inherit;
}
.toolbar a.btn.primary { color: white; border-color: #176356; }
details > summary { cursor: pointer; font-weight: 600; }
button:hover {
  background: #edf3f0;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: #176356;
  color: white;
  border-color: #176356;
}
.primary:hover {
  background: #124e44;
}
.danger {
  color: #a33f35;
}
.quiet {
  border: 0;
  background: transparent;
}
.shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #123d35;
  color: #e5eeea;
  padding: 32px 18px;
  position: fixed;
  inset: 0 auto 0 0;
  width: 230px;
  display: flex;
  flex-direction: column;
}
.brand {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 0 16px 28px;
}
.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 3px;
  color: #9fc0b5;
  margin-top: 7px;
}
.nav-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: #92b0a5;
  padding: 20px 16px 10px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nav button {
  text-align: left;
  border: 0;
  background: transparent;
  color: #c8dbd2;
  padding: 13px 16px;
}
.nav button.active,
.nav button:hover {
  background: #2c594d;
  color: white;
}
.nav button span {
  display: inline-block;
  width: 30px;
  opacity: 0.7;
}
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid #35594f;
  padding: 20px 12px 0;
  font-size: 12px;
  color: #a6c0b5;
}
.main {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 38px;
  border-bottom: 1px solid #e0e6e2;
  background: white;
}
.crumb {
  color: #77877f;
  font-size: 13px;
}
.profile {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  background: #e5eee9;
  color: #176356;
  border-radius: 50%;
  padding: 9px;
  font-size: 12px;
}
.workspace {
  padding: 32px 38px 60px;
  max-width: 1600px;
  margin: auto;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 27px;
}
h1 {
  font-size: 27px;
  letter-spacing: -0.7px;
  margin: 0 0 9px;
  font-weight: 650;
}
h2 {
  font-size: 17px;
  margin: 0;
}
h3 {
  font-size: 15px;
  margin: 0 0 15px;
}
p {
  line-height: 1.8;
}
.muted {
  color: #7d8b83;
  font-size: 13px;
}
.eyebrow {
  color: #176356;
  letter-spacing: 2px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 10px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin: 24px 0;
}
.card {
  background: white;
  border: 1px solid #e1e7e3;
  border-radius: 10px;
  padding: 22px;
}
.metric {
  font-size: 31px;
  margin: 16px 0 10px;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.metric small {
  font-size: 14px;
  color: #8b9991;
  margin-left: 5px;
}
.panel {
  background: white;
  border: 1px solid #e0e7e2;
  border-radius: 10px;
  margin-bottom: 22px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 21px 24px;
  border-bottom: 1px solid #e8ece9;
  gap: 12px;
}
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}
.toolbar input {
  max-width: 300px;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
}
th {
  background: #f9faf9;
  color: #7b8881;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  padding: 14px 20px;
}
td {
  padding: 17px 20px;
  border-top: 1px solid #edf0ee;
  font-size: 13px;
}
tbody tr:hover {
  background: #fbfcfb;
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 4px;
  font-size: 11px;
  background: #edf1ef;
  color: #687970;
}
.badge.green {
  background: #e6f3ec;
  color: #247153;
}
.badge.gold {
  background: #fcf2da;
  color: #8a6a23;
}
.badge.blue {
  background: #eaf0f9;
  color: #496e9e;
}
.link {
  color: #176356;
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: 600;
}
.empty {
  text-align: center;
  padding: 48px;
  color: #8a968f;
}
.notice {
  border: 1px solid #ead8a4;
  background: #fffbef;
  color: #826a2e;
  border-radius: 7px;
  padding: 13px 17px;
  font-size: 12px;
  line-height: 1.8;
  margin-bottom: 20px;
}
.split {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 22px;
}
.steps {
  padding: 25px;
  display: grid;
  gap: 24px;
}
.step {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}
.step b {
  border: 1px solid #d9e4dd;
  border-radius: 50%;
  font-size: 12px;
  padding: 7px 10px;
  color: #176356;
}
.step p {
  margin: 6px 0 0;
  color: #87948c;
  font-size: 12px;
}
label {
  display: block;
  font-size: 12px;
  color: #62756b;
  margin-bottom: 6px;
}
input,
select,
textarea {
  border: 1px solid #d8e2dc;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  width: 100%;
  color: #233c31;
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #3e8771;
  box-shadow: 0 0 0 3px #eaf3ee;
}
textarea {
  min-height: 75px;
  resize: vertical;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}
.full {
  grid-column: 1/-1;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e7ede8;
  padding-top: 20px;
  margin-top: 24px;
}
dialog {
  border: 0;
  border-radius: 12px;
  box-shadow: 0 24px 100px #183e3430;
  width: min(850px, 94vw);
  max-height: 90vh;
  padding: 28px;
}
dialog::backdrop {
  background: #132d286b;
  backdrop-filter: blur(2px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.lines-editor {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}
.line-editor {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 40px;
  gap: 8px;
}
.inline-error {
  color: #b54a3f;
  background: #fff0eb;
  padding: 10px;
  border-radius: 6px;
  margin: 12px 0;
  display: none;
}
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: white;
}
.login-art {
  background: #123d35;
  color: #f1f8f3;
  padding: 60px 12%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-art h1 {
  font-size: 48px;
  line-height: 1.45;
  margin: 50px 0 25px;
}
.login-art p {
  color: #b9d0c3;
  max-width: 380px;
  font-size: 16px;
}
.login-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.login-form form {
  width: 350px;
}
.login-form h1 {
  margin-bottom: 14px;
}
.login-form label {
  margin-top: 24px;
}
.login-form button {
  width: 100%;
  margin-top: 30px;
  padding: 13px;
}
.login-footer {
  font-size: 11px;
  color: #90aba0;
  margin-top: 60px;
}
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #183f33;
  color: white;
  padding: 13px 24px;
  border-radius: 7px;
  z-index: 20;
  display: none;
  box-shadow: 0 6px 30px #0002;
}
.tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.tabs .selected {
  background: #e7f0eb;
  border-color: #bed3c5;
  color: #176356;
}
.detail-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 20px 0;
}
.detail-meta small {
  display: block;
  color: #849287;
  margin-bottom: 6px;
}
.progress {
  height: 5px;
  background: #e7eeea;
  border-radius: 4px;
  overflow: hidden;
  width: 120px;
  margin-top: 6px;
}
.progress div {
  height: 100%;
  background: #398570;
}
.padded {
  padding: 24px;
}
.file-drop {
  border: 1px dashed #adc4b7;
  background: #f8fbf9;
  border-radius: 10px;
  padding: 30px;
  margin: 20px 0;
}
.file-drop input {
  background: white;
  margin-top: 16px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 300px;
  overflow: auto;
  background: #f6f8f6;
  padding: 16px;
  font-size: 12px;
}
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
}
.page-note {
  font-size: 11px;
  color: #8c9991;
  margin-top: 30px;
}
.loading {
  padding: 50px;
  text-align: center;
  color: #176356;
}
@media (max-width: 1000px) {
  .sidebar {
    width: 185px;
  }
  .shell {
    grid-template-columns: 185px 1fr;
  }
  .workspace {
    padding: 24px;
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .split {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 24px;
  }
}
@media (max-width: 650px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 16px;
  }
  .shell {
    display: block;
  }
  .brand {
    padding: 0 10px 10px;
    font-size: 20px;
  }
  .brand small,
  .sidebar-bottom,
  .nav-label {
    display: none;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .nav button {
    padding: 8px;
  }
  .nav button span {
    display: none;
  }
  .topbar {
    height: 60px;
    padding: 0 16px;
  }
  .workspace {
    padding: 24px 16px;
  }
  .profile {
    gap: 5px;
  }
  .profile .avatar {
    display: none;
  }
  .heading {
    align-items: flex-start;
  }
  h1 {
    font-size: 23px;
  }
  .cards {
    gap: 10px;
  }
  .card {
    padding: 16px;
  }
  .metric {
    font-size: 25px;
  }
  .grid,
  .detail-meta {
    grid-template-columns: 1fr;
  }
  .login {
    display: block;
  }
  .login-art {
    padding: 25px;
  }
  .login-art h1,
  .login-art p,
  .login-footer {
    display: none;
  }
  .login-form {
    padding-top: 50px;
  }
  .line-editor {
    grid-template-columns: 2fr 1fr 1fr 30px;
  }
  .line-editor input,
  .line-editor select {
    padding: 8px 4px;
  }
  td,
  th {
    padding: 12px;
  }
  .crumb {
    font-size: 11px;
  }
  .full {
    grid-column: auto;
  }
}
@media print {
  .sidebar,
  .topbar,
  .toolbar,
  .form-actions,
  button,
  .notice {
    display: none !important;
  }
  .shell {
    display: block;
  }
  .workspace {
    padding: 0;
  }
  .main {
    display: block;
  }
  dialog {
    position: static;
    max-height: none;
    width: 100%;
    box-shadow: none;
  }
  body:has(dialog[open]) #root {
    display: none;
  }
  dialog::backdrop {
    background: white;
  }
}

/* Device details remain visible at every stage. */
.line-editor {
  display: block;
  padding: 16px;
  border: 1px solid #dfe8e2;
  border-radius: 8px;
  background: #fbfcfb;
}
.line-inputs {
  display: grid;
  grid-template-columns: minmax(200px, 3fr) 1fr 1fr 35px;
  gap: 12px;
  align-items: end;
}
.device-attributes {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr;
  gap: 16px;
  background: #f3f7f4;
  padding: 14px;
  border-radius: 6px;
  margin: 14px 0;
}
.device-attributes span,
.device-attributes strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 500;
}
dialog {
  width: min(1050px, 96vw);
}
@media (max-width: 650px) {
  .line-inputs {
    grid-template-columns: 1fr 1fr;
  }
  .line-inputs > div:first-child {
    grid-column: 1/-1;
  }
  .device-attributes {
    grid-template-columns: 1fr 1fr;
  }
  .line-inputs button {
    justify-self: end;
  }
  .line-editor {
    padding: 12px;
  }
}

.device-picker {
  position: relative;
}
.device-options {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 5;
  max-height: 270px;
  overflow: auto;
  background: white;
  border: 1px solid #b6cfc1;
  box-shadow: 0 10px 24px #163b3020;
  border-radius: 7px;
}
.device-options button {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #edf0ed;
  text-align: left;
  border-radius: 0;
  padding: 12px;
}
.device-options button span {
  display: block;
  color: #76867c;
  font-size: 12px;
  margin-top: 4px;
}
.device-options button:focus {
  outline: 2px solid #21705b;
  outline-offset: -2px;
  background: #edf6f0;
}
.device-options > .muted {
  padding: 12px;
}

.report-table td, .report-table th { padding: 12px; font-size: 12px; vertical-align: top; }
