/* Residents suite, Maintenance tab (Phase 2a): work orders board, list, detail, form and vendors.
   Spec: Fix Mds/residents-suite-phase2a-spec.md §5. Builds on residents.css (page, stats strip, empty card).
   Shell tokens only (design rule, CLAUDE.md "New screens match the app's design"); the app's .btn and .form-input. */

.mt-wrap { width: 100%; max-width: 1400px; display: flex; flex-direction: column; gap: 12px; color: var(--text); }
.mt-wrap .res-empty { align-self: center; }
.mt-bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-bar-right .btn, .mt-panel .btn { display: inline-flex; align-items: center; gap: 6px; }
.mt-bar-right .btn svg, .mt-panel .btn svg { width: 16px; height: 16px; }
.mt-stat-alert .res-stat-v { color: var(--danger); }

.mt-tabs { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg3); border: 1px solid var(--border); border-radius: 999px; }
.mt-tab {
  border: 0; background: transparent; color: var(--text2); font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.mt-tab.is-on { background: var(--bg); color: var(--text); box-shadow: var(--shadow-xs); }

.mt-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.mt-search { flex: 1 1 240px; max-width: 360px; }
.mt-filter { width: auto; min-width: 140px; }

/* Board: one column per open status, scrolls sideways on narrow desktops. */
.mt-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.mt-col {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-xl, 16px);
  display: flex; flex-direction: column; min-height: 160px;
}
.mt-col-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px 6px; font-size: 12.5px; font-weight: 700; color: var(--text2);
}
.mt-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--bg3); color: var(--text2); font-size: 11.5px; text-align: center; }
.mt-col-body { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px 10px; }
.mt-col-empty { font-size: 12px; color: var(--text3, var(--text2)); padding: 8px 4px; }

.mt-card, .mt-row {
  font: inherit; text-align: left; color: var(--text); cursor: pointer; width: 100%;
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--radius-lg, 12px); box-shadow: var(--shadow-xs);
}
.mt-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; }
.mt-card:hover, .mt-row:hover { border-color: var(--accent); }
div.mt-row { cursor: default; }
.mt-card:focus-visible, .mt-row:focus-visible, .mt-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mt-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mt-card-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.mt-sub { font-size: 12px; color: var(--text2); }
.mt-muted { color: var(--text3, var(--text2)); }
.mt-cat { font-size: 11.5px; color: var(--text2); }

.mt-pri { padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--bg3); color: var(--text2); }
.mt-pri-emergency { background: var(--danger-soft); color: var(--danger); }
.mt-pri-urgent { background: var(--gold-soft); color: var(--gold); }
.mt-pri-low { color: var(--text3, var(--text2)); }
.mt-status { padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }

/* List and vendors: a table on desktop, cards on the phone. */
.mt-list { display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius-xl, 16px); box-shadow: var(--shadow-xs); overflow: hidden; }
.mt-list .mt-row {
  display: grid; grid-template-columns: minmax(220px, 2.2fr) 1.1fr 0.9fr 1.2fr 1fr; gap: 12px; align-items: center;
  border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; padding: 11px 16px; font-size: 13.5px;
}
.mt-list .mt-row:first-child { border-top: 0; }
.mt-list .mt-row-head { background: var(--bg2); font-size: 12px; font-weight: 600; color: var(--text2); cursor: default; }
.mt-list .mt-row-head:hover { border-color: var(--border); }
.mt-inactive { opacity: .6; }
.mt-none { padding: 24px; text-align: center; color: var(--text2); font-size: 13.5px; }

/* Detail and forms: full panels inside the page, with Back (never a popup). */
.mt-panel { width: 100%; max-width: 760px; display: flex; flex-direction: column; gap: 12px; color: var(--text); }
.mt-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt-detail-card {
  background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius-xl, 16px);
  box-shadow: var(--shadow-xs); padding: 18px 20px;
}
.mt-detail-title { margin: 8px 0 6px; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.mt-h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text); }
.mt-desc { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--text2); white-space: pre-wrap; }
.mt-facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.mt-facts div { min-width: 0; }
.mt-facts dt { font-size: 11.5px; color: var(--text2); }
.mt-facts dd { margin: 2px 0 0; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.mt-moves { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

.mt-note-box { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; }
.mt-note-box textarea { flex: 1; resize: vertical; }
.mt-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mt-timeline li { padding: 10px 0 10px 16px; border-left: 2px solid var(--border); position: relative; }
.mt-timeline li::before {
  content: ''; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.mt-tl-what { font-size: 13.5px; font-weight: 600; }
.mt-tl-note { font-size: 13.5px; color: var(--text); margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }

.mt-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.mt-form .mt-detail-title, .mt-form .mt-desc { grid-column: 1 / -1; }
.mt-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text2); min-width: 0; }
.mt-field .form-input { width: 100%; }
.mt-wide { grid-column: 1 / -1; }
.mt-check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; }
.mt-form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Phone: the board becomes one column, grouped by status; rows become cards with labels. */
@media (max-width: 768px) {
  .mt-wrap { gap: 10px; }
  .mt-bar-right { justify-content: space-between; }
  .mt-bar-right .btn-primary { flex: 1; justify-content: center; }
  .mt-tabs { width: 100%; }
  .mt-tab { flex: 1; }
  .mt-search { max-width: none; }
  .mt-filter { flex: 1; min-width: 0; }
  .mt-board { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr; overflow: visible; }
  .mt-col { min-height: 0; background: transparent; border: 0; }
  .mt-col-head { padding: 6px 2px; }
  .mt-col-body { padding: 0; }
  .mt-col:has(.mt-col-empty) { display: none; }
  .mt-list { background: transparent; border: 0; box-shadow: none; gap: 10px; overflow: visible; }
  .mt-list .mt-row-head { display: none; }
  .mt-list .mt-row {
    grid-template-columns: 1fr; gap: 6px;
    background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius-xl, 16px); box-shadow: var(--shadow-xs);
  }
  .mt-list .mt-row:first-child { border-top: 1px solid var(--border2); }
  .mt-list .mt-row > [data-label] { display: flex; justify-content: space-between; gap: 12px; text-align: right; font-size: 13px; }
  .mt-list .mt-row > [data-label]::before { content: attr(data-label); color: var(--text2); font-size: 12px; text-align: left; }
  .mt-detail-card { padding: 16px; }
  .mt-facts, .mt-form { grid-template-columns: 1fr; }
  .mt-note-box { flex-direction: column; align-items: stretch; }
  .mt-form-actions .btn { flex: 1; justify-content: center; }
}
