/* Device detail: maintenance card stacks under device info in the side column;
   idle pumps span the full width below so both columns end on the same line */
.dd-grid.with-mt { grid-template-areas: "meter info" "meter maint" "rest rest"; grid-template-rows: auto 1fr auto; }
.dd-maint { grid-area: maint; min-width: 0; }
.dd-grid.with-mt > .pump-rest { grid-area: rest; min-width: 0; }
.dd-grid.mt-fill .dd-meters { align-self: stretch; }
.dd-grid.mt-fill .dd-meters > .meter { flex: 1; display: flex; flex-direction: column; }
.dd-grid.mt-fill .dd-meters > .meter > .meter-stage { flex: 1; }
.dd-grid.mt-fill .dd-maint { align-self: stretch; display: flex; flex-direction: column; }
.dd-grid.mt-fill .dd-maint .mt-body { flex: 1; grid-template-rows: auto auto auto auto 1fr; }
.dd-grid.mt-fill .dd-maint .mt-kv { align-self: end; }
.dd-grid.with-mt .mt-body {
  grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: start; padding: 10px 16px 12px;
}
.dd-grid.with-mt .mt-body > div:first-child { display: contents; }
.dd-grid.with-mt .mt-main { display: contents; }
.dd-grid.with-mt .mt-main b { grid-column: 1; grid-row: 1; align-self: center; font-size: 26px; }
.dd-grid.with-mt .mt-main span { grid-column: 1 / -1; margin-top: -2px; }
.dd-grid.with-mt .mt-actions { grid-column: 2; grid-row: 1; }
.dd-grid.with-mt .mt-sub { grid-column: 1 / -1; margin: 0; }
.dd-grid.with-mt .mt-body .el-progress { grid-column: 1 / -1; }
.dd-grid.with-mt .mt-kv { grid-template-columns: minmax(0, 1fr); gap: 0; grid-column: 1 / -1; grid-row: auto; margin-top: 4px; }
.dd-grid.with-mt .mt-kv > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border: 0; border-radius: 0; padding: 9px 0; line-height: 1.4;
}
.dd-grid.with-mt .mt-kv > div + div { border-top: 1px solid var(--el-border-color-lighter); }
.dd-grid.with-mt .mt-kv dt { font-size: var(--fs-sm); white-space: nowrap; }
.dd-grid.with-mt .mt-kv dd { margin: 0; font-size: var(--fs-sm); }
.mt-badge { font-size: var(--fs-xs); font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.mt-badge.ok { color: var(--app-ok-text); background: var(--el-color-success-light-9); }
.mt-badge.soon { color: var(--app-warn-text); background: var(--el-color-warning-light-9); }
.mt-badge.over { color: var(--app-bad-text); background: var(--el-color-danger-light-9); }
.mt-head-left { display: flex; align-items: center; gap: 10px; }
.mt-empty { padding: 12px 16px 0; font-size: var(--fs-sm); line-height: 1.5; }
.mt-body { display: grid; grid-template-columns: minmax(260px, 1.2fr) minmax(0, 1.6fr) auto; gap: 22px; align-items: center; padding: 14px 16px; }
.mt-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mt-main b { font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.mt-main span { color: var(--el-text-color-secondary); font-size: var(--fs-sm); }
.mt-sub { font-size: var(--fs-sm); color: var(--el-text-color-secondary); margin: 6px 0 10px; }
.mt-sub.soon { color: var(--app-warn-text); font-weight: 600; }
.mt-sub.over { color: var(--app-bad-text); font-weight: 600; }
.mt-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.mt-kv > div { border: 1px solid var(--el-border-color-lighter); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.mt-kv dt { font-size: var(--fs-xs); color: var(--el-text-color-secondary); }
.mt-kv dd { margin: 3px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-head-tools { display: inline-flex; align-items: center; gap: 6px; }
.mt-head-tools .el-button + .el-button { margin-left: 0; }

/* Dialogs */
.mt-dlg-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.mt-dlg-sum > div { background: var(--el-fill-color-light); border-radius: 10px; padding: 8px 12px; }
.mt-dlg-sum dt { font-size: var(--fs-xs); color: var(--el-text-color-secondary); }
.mt-dlg-sum dd { margin: 2px 0 0; font-weight: 600; }
.mt-hint { font-size: var(--fs-xs); color: var(--el-text-color-secondary); margin-top: 4px; width: 100%; line-height: 1.5; }

/* Device list column */
.mt-cell { padding: 4px 0; line-height: 1.3; }
.mt-cell small { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--el-text-color-secondary); }

/* Dashboard */
.mt-due-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.mt-due-row + .mt-due-row { border-top: 1px solid var(--el-border-color-lighter); }
.mt-due-row .name { font-weight: 600; min-width: 170px; }
.mt-due-row .name small { font-weight: 400; color: var(--el-text-color-secondary); font-size: var(--fs-xs); }
.mt-due-row .el-tag { min-width: 96px; }
.mt-due-row .bar { flex: 1; min-width: 120px; }
.mt-due-row .h { width: 150px; text-align: right; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }

@media (max-width: 1200px) {
  .mt-body { grid-template-columns: minmax(0, 1fr) auto; }
  .mt-kv { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 900px) {
  .dd-grid.with-mt { grid-template-areas: "meter" "rest" "maint" "info"; grid-template-rows: none; }
}
@media (max-width: 600px) {
  .mt-body { grid-template-columns: 1fr; gap: 12px; }
  .mt-kv { grid-template-columns: 1fr 1fr; grid-row: auto; }
  .mt-kv > div:last-child { grid-column: 1 / -1; }
  .mt-actions .el-button { width: 100%; }
  .mt-due-row { flex-wrap: wrap; }
  .mt-due-row .name { min-width: 0; flex: 1; }
  .mt-due-row .bar { flex-basis: 100%; order: 3; }
  .mt-due-row .h { width: auto; }
}
