/**
 * Maintenance — Zyareo Phase 5A
 * Pending work first. Prefixed .mt-*.
 */

body.mt {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--zy-font-sans);
  background: var(--zy-ivory);
  color: var(--zy-charcoal);
  overflow-x: hidden;
}

.mt-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--zy-space-2);
  align-items: center;
  padding: var(--zy-space-3) var(--zy-space-4);
  padding-top: max(var(--zy-space-3), env(safe-area-inset-top));
  background: var(--zy-charcoal);
  color: var(--zy-ivory);
  position: sticky;
  top: 0;
  z-index: 5;
}

.mt-identity {
  display: flex;
  flex-wrap: wrap;
  gap: var(--zy-space-2);
  align-items: center;
  margin-right: auto;
  min-width: 0;
}
.mt-code {
  font-size: var(--zy-text-xs);
  color: rgba(243, 239, 230, 0.72);
}

.mt-pill {
  font-size: var(--zy-text-xs);
  font-weight: var(--zy-weight-semibold);
  padding: 0.3rem 0.55rem;
  border-radius: var(--zy-radius-sm);
  background: rgba(255, 255, 255, 0.12);
}
.mt-pill.ok {
  background: var(--zy-emerald);
  color: #fff;
}
.mt-pill.warn {
  background: var(--zy-gold);
  color: var(--zy-charcoal);
}
.mt-pill.bad {
  background: var(--zy-error);
  color: #fff;
}

.mt-prop {
  display: flex;
  gap: var(--zy-space-2);
  align-items: center;
  font-size: var(--zy-text-sm);
}
.mt-prop select {
  min-height: 2.75rem;
  border-radius: var(--zy-radius-md);
  border: 0;
  padding: 0.35rem 0.55rem;
  font: inherit;
  max-width: 11rem;
}

.mt-link {
  color: rgba(243, 239, 230, 0.85);
  text-decoration: none;
  font-size: var(--zy-text-sm);
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

.mt-nav {
  display: flex;
  gap: var(--zy-space-2);
  padding: var(--zy-space-2) var(--zy-space-4);
  background: var(--zy-paper);
  border-bottom: 1px solid var(--zy-border);
  overflow-x: auto;
}
.mt-nav button {
  border: 1px solid var(--zy-border);
  background: var(--zy-white);
  padding: 0.55rem 0.9rem;
  border-radius: var(--zy-radius-md);
  font-weight: var(--zy-weight-semibold);
  min-height: 2.75rem;
  cursor: pointer;
  font: inherit;
  color: var(--zy-charcoal);
  white-space: nowrap;
}
.mt-nav button.active {
  background: var(--zy-charcoal);
  color: #fff;
  border-color: var(--zy-charcoal);
}

.mt-banner {
  margin: var(--zy-space-3) var(--zy-space-4) 0;
  padding: var(--zy-space-3);
  border-radius: var(--zy-radius-md);
  font-size: var(--zy-text-sm);
}
.mt-banner.error {
  background: var(--zy-error-soft);
  color: var(--zy-error);
}
.mt-banner.ok {
  background: var(--zy-success-soft);
  color: var(--zy-success);
}
.mt-banner.setup {
  background: var(--zy-warning-soft);
  color: var(--zy-warning);
}

.mt-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--zy-space-3);
  padding: var(--zy-space-3) var(--zy-space-4);
}
.mt-filters label {
  display: flex;
  flex-direction: column;
  gap: var(--zy-space-1);
  font-size: var(--zy-text-xs);
  font-weight: var(--zy-weight-semibold);
  color: var(--zy-text-muted);
  letter-spacing: var(--zy-tracking-wide);
  text-transform: uppercase;
}
.mt-filters select,
.mt-filters input {
  min-height: 2.75rem;
  min-width: min(100%, 8rem);
  border-radius: var(--zy-radius-md);
  border: 1px solid var(--zy-border);
  padding: 0.35rem 0.55rem;
  font: inherit;
  background: var(--zy-white);
  text-transform: none;
  letter-spacing: normal;
  color: var(--zy-charcoal);
  font-weight: var(--zy-weight-regular);
}

.mt-main {
  padding: var(--zy-space-3) var(--zy-space-4);
  padding-bottom: max(var(--zy-space-6), env(safe-area-inset-bottom));
  max-width: 56rem;
  margin: 0 auto;
  box-sizing: border-box;
  width: 100%;
}

.mt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5rem), 1fr));
  gap: var(--zy-space-2);
  margin-bottom: var(--zy-space-4);
}
.mt-stat {
  background: var(--zy-white);
  border: 1px solid var(--zy-border);
  border-radius: var(--zy-radius-lg);
  padding: var(--zy-space-3);
  box-shadow: var(--zy-shadow-sm);
}
.mt-stat strong {
  display: block;
  font-size: var(--zy-text-2xl);
  color: var(--zy-emerald-deep);
}
.mt-stat span {
  font-size: var(--zy-text-xs);
  color: var(--zy-text-muted);
}

.mt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--zy-space-2);
}
.mt-list li {
  background: var(--zy-white);
  border-radius: var(--zy-radius-lg);
  padding: var(--zy-space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--zy-space-2);
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--zy-border);
  border-left: 4px solid var(--zy-border-strong);
  cursor: pointer;
  box-shadow: var(--zy-shadow-sm);
  min-height: 3.75rem;
}
.mt-list li.open {
  border-left-color: var(--zy-warning);
  background: var(--zy-gold-soft);
}
.mt-list li.in_progress {
  border-left-color: var(--zy-info);
}
.mt-list li.completed {
  border-left-color: var(--zy-success);
}
.mt-list .muted {
  color: var(--zy-text-muted);
  font-size: var(--zy-text-sm);
}

.mt-btn {
  border: 1px solid transparent;
  border-radius: var(--zy-radius-md);
  padding: 0.7rem 1rem;
  font-weight: var(--zy-weight-semibold);
  min-height: 2.75rem;
  cursor: pointer;
  font: inherit;
}
.mt-btn.primary {
  background: var(--zy-emerald);
  color: #fff;
}
.mt-btn.ghost {
  background: var(--zy-paper);
  color: var(--zy-charcoal);
  border-color: var(--zy-border);
}
.mt-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mt-dialog {
  border: 1px solid var(--zy-border);
  border-radius: var(--zy-radius-lg);
  padding: 0;
  max-width: 28rem;
  width: calc(100% - 2rem);
  max-height: min(90dvh, 40rem);
  overflow: auto;
  background: var(--zy-white);
}
.mt-dialog-body {
  padding: var(--zy-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--zy-space-3);
}
.mt-dialog-body label {
  display: flex;
  flex-direction: column;
  gap: var(--zy-space-1);
  font-size: var(--zy-text-sm);
  font-weight: var(--zy-weight-semibold);
}
.mt-dialog-body input,
.mt-dialog-body select,
.mt-dialog-body textarea {
  min-height: 2.75rem;
  border-radius: var(--zy-radius-md);
  border: 1px solid var(--zy-border);
  padding: 0.45rem 0.65rem;
  font: inherit;
  background: var(--zy-white);
  font-weight: var(--zy-weight-regular);
}
.mt-meta {
  color: var(--zy-text-muted);
  margin: 0;
  font-size: var(--zy-text-sm);
}
.mt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--zy-space-2);
}
.mt-actions .mt-btn {
  flex: 1 1 auto;
  min-width: 6.5rem;
}

@media (prefers-reduced-motion: reduce) {
  body.mt *,
  body.mt *::before,
  body.mt *::after {
    animation: none !important;
    transition: none !important;
  }
}
