/* ══════════════════════════════════════════════════════════════════════
   MARVYN AI — Maintenance Module CSS
   Standalone module — injected without touching existing styles
   ══════════════════════════════════════════════════════════════════════ */

/* ─── Sidebar nav item (left sidebar) ───────────────────────────────── */
#marvyn-maint-nav {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3, #64748b);
  cursor: pointer;
  position: relative;
  transition: all .2s;
  flex-shrink: 0;
}
#marvyn-maint-nav:hover {
  background: var(--bg3, #1e2a3a);
  color: var(--text2, #94a3b8);
}
#marvyn-maint-nav.active {
  background: var(--amber-dim, rgba(245,158,11,.12));
  color: var(--amber, #f59e0b);
}
#marvyn-maint-nav.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 25%;
  bottom: 25%;
  width: 2px;
  background: var(--amber, #f59e0b);
  border-radius: 0 2px 2px 0;
}
#marvyn-maint-nav svg { width: 18px; height: 18px; }
#marvyn-maint-nav .maint-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 15px;
  height: 15px;
  background: #ef4444;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}
/* Tooltip */
#marvyn-maint-nav::after {
  content: 'Manutenção';
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg4, #1a2535);
  color: var(--text1, #e2e8f0);
  font-size: 11px;
  font-family: 'Outfit', sans-serif;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(255,255,255,.08));
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 9050;
}
#marvyn-maint-nav:hover::after {
  opacity: 1;
}

/* ─── Full Overlay Panel ─────────────────────────────────────────────── */
#marvyn-maint-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  background: rgba(6,12,20,.85);
  backdrop-filter: blur(4px);
  display: none;
  animation: mOverlayIn .2s ease;
}
#marvyn-maint-overlay.open { display: flex; }
@keyframes mOverlayIn { from { opacity: 0; } to { opacity: 1; } }

#marvyn-maint-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(1200px, 100vw);
  background: #060c14;
  border-left: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  animation: mPanelIn .25s ease;
  overflow: hidden;
}
@keyframes mPanelIn { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Panel Header ───────────────────────────────────────────────────── */
.mp-header {
  height: 56px;
  background: #0a1220;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}
.mp-header-icon {
  width: 32px;
  height: 32px;
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mp-header h2 {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #e2e8f0;
  letter-spacing: .3px;
  margin: 0;
}
.mp-header-sub {
  font-size: 11px;
  color: #475569;
  font-family: 'Outfit', sans-serif;
  margin-left: 2px;
}
.mp-header-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.mp-btn {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
  white-space: nowrap;
}
.mp-btn-primary {
  background: #f59e0b;
  color: #000;
}
.mp-btn-primary:hover { background: #d97706; }
.mp-btn-secondary {
  background: rgba(34,211,238,.1);
  color: #22d3ee;
  border: 1px solid rgba(34,211,238,.25);
}
.mp-btn-secondary:hover { background: rgba(34,211,238,.18); }
.mp-btn-ghost {
  background: rgba(255,255,255,.05);
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,.08);
}
.mp-btn-ghost:hover { background: rgba(255,255,255,.09); color: #e2e8f0; }
.mp-btn-close {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239,68,68,.08);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 7px;
  flex-shrink: 0;
}
.mp-btn-close:hover { background: rgba(239,68,68,.18); }

/* ─── KPI Row ────────────────────────────────────────────────────────── */
.mp-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.mp-kpi {
  padding: 12px 16px;
  border-right: 1px solid rgba(255,255,255,.06);
  background: #0a1220;
}
.mp-kpi:last-child { border-right: none; }
.mp-kpi-label {
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #475569;
  font-family: 'Outfit', sans-serif;
  margin-bottom: 3px;
}
.mp-kpi-val {
  font-family: 'Rajdhani', sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

/* ─── Toolbar ────────────────────────────────────────────────────────── */
.mp-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  flex-wrap: wrap;
  background: #0a1220;
}
.mp-filter-btn {
  padding: 5px 13px;
  border-radius: 6px;
  font-size: 11px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: rgba(255,255,255,.05);
  color: #475569;
  transition: all .18s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.mp-filter-btn:hover { background: rgba(255,255,255,.09); color: #94a3b8; }
.mp-filter-btn.active { color: #000; border-color: transparent; }
.mp-filter-btn[data-f="all"].active    { background: #94a3b8; }
.mp-filter-btn[data-f="atrasado"].active   { background: #ef4444; }
.mp-filter-btn[data-f="em_andamento"].active { background: #22d3ee; }
.mp-filter-btn[data-f="agendado"].active  { background: #f59e0b; }
.mp-filter-btn[data-f="concluido"].active  { background: #10b981; }
.mp-filter-btn[data-f="cancelado"].active  { background: #475569; color: #e2e8f0; }
.mp-filter-btn .mp-count {
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}
.mp-search {
  margin-left: auto;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 7px;
  padding: 6px 12px;
  color: #e2e8f0;
  font-size: 12px;
  font-family: 'Outfit', sans-serif;
  width: 200px;
  outline: none;
  transition: border-color .2s;
}
.mp-search:focus { border-color: rgba(245,158,11,.4); }
.mp-search::placeholder { color: #2d3f55; }

/* ─── Order List ─────────────────────────────────────────────────────── */
.mp-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  color: #2d3f55;
  padding: 60px;
}
.mp-empty svg { opacity: .3; }
.mp-empty p { font-size: 13px; font-family: 'Outfit', sans-serif; }

.mp-card {
  background: #0f1929;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 0 12px;
  align-items: start;
  transition: border-color .2s;
  cursor: default;
  position: relative;
}
.mp-card:hover { border-color: rgba(255,255,255,.12); }
.mp-card-bar {
  width: 4px;
  border-radius: 3px;
  align-self: stretch;
  flex-shrink: 0;
}
.mp-card-main { min-width: 0; }
.mp-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.mp-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  font-family: 'Outfit', sans-serif;
}
.mp-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 5px;
}
.mp-card-meta-item {
  font-size: 11px;
  color: #475569;
  font-family: 'Outfit', sans-serif;
  display: flex;
  align-items: center;
  gap: 4px;
}
.mp-card-meta-item svg { flex-shrink: 0; opacity: .6; }
.mp-card-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  flex-shrink: 0;
}
.mp-status-badge {
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: .3px;
  white-space: nowrap;
}
.mp-priority-badge {
  font-size: 10px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}
.mp-deadline {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: #475569;
}
.mp-deadline.overdue { color: #ef4444; font-weight: 600; }
.mp-deadline.soon { color: #f59e0b; }
.mp-action-select {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 5px;
  color: #94a3b8;
  font-size: 10px;
  padding: 3px 6px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  outline: none;
  transition: border-color .2s;
}
.mp-action-select:hover { border-color: rgba(245,158,11,.3); }

/* ─── Modal ──────────────────────────────────────────────────────────── */
#marvyn-maint-modal {
  position: fixed;
  inset: 0;
  z-index: 9200;
  background: rgba(6,12,20,.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#marvyn-maint-modal.open { display: flex; }

.mp-modal-box {
  background: #0a1220;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: mModalIn .2s ease;
  overflow: hidden;
}
@keyframes mModalIn { from { transform: scale(.97) translateY(-10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

.mp-modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mp-modal-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mp-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.mp-field { display: flex; flex-direction: column; gap: 5px; }
.mp-field.full { grid-column: 1 / -1; }
.mp-label {
  font-size: 10px;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: #475569;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}
.mp-label .mp-req { color: #ef4444; margin-left: 2px; }
.mp-input, .mp-select, .mp-textarea {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 7px;
  padding: 8px 12px;
  color: #e2e8f0;
  font-size: 12.5px;
  font-family: 'Outfit', sans-serif;
  outline: none;
  transition: border-color .2s;
  width: 100%;
  box-sizing: border-box;
}
.mp-input:focus, .mp-select:focus, .mp-textarea:focus {
  border-color: rgba(245,158,11,.4);
}
.mp-select { background: #060c14; cursor: pointer; }
.mp-select option { background: #0a1220; }
.mp-textarea { resize: vertical; min-height: 72px; }
.mp-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── PDF Report Modal ───────────────────────────────────────────────── */
#marvyn-pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 9300;
  background: rgba(6,12,20,.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#marvyn-pdf-modal.open { display: flex; }
.mp-pdf-box {
  background: #0a1220;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  animation: mModalIn .2s ease;
  overflow: hidden;
}
.mp-pdf-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────── */
#marvyn-maint-panel ::-webkit-scrollbar,
#marvyn-maint-modal ::-webkit-scrollbar,
#marvyn-pdf-modal ::-webkit-scrollbar { width: 4px; }
#marvyn-maint-panel ::-webkit-scrollbar-track,
#marvyn-maint-modal ::-webkit-scrollbar-track,
#marvyn-pdf-modal ::-webkit-scrollbar-track { background: transparent; }
#marvyn-maint-panel ::-webkit-scrollbar-thumb,
#marvyn-maint-modal ::-webkit-scrollbar-thumb,
#marvyn-pdf-modal ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

/* ─── Toast ──────────────────────────────────────────────────────────── */
#marvyn-toasts {
  position: fixed;
  bottom: 20px;
  right: 56px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.marvyn-toast {
  background: #0f1929;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-family: 'Outfit', sans-serif;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: mToastIn .2s ease;
  min-width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
@keyframes mToastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.marvyn-toast.ok   { border-left: 3px solid #10b981; }
.marvyn-toast.err  { border-left: 3px solid #ef4444; }
.marvyn-toast.warn { border-left: 3px solid #f59e0b; }

/* ─── Loading spinner ────────────────────────────────────────────────── */
.mp-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(245,158,11,.2);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: mSpin .6s linear infinite;
  flex-shrink: 0;
}
@keyframes mSpin { to { transform: rotate(360deg); } }
.mp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: #475569;
  font-size: 13px;
  font-family: 'Outfit', sans-serif;
}
